Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted?
When you write an M-file in MATLAB, you can either write a script or a function. The difference is that a script is read from the disk and parsed line by line each time it is called. A function is loaded into RAM for execution. Because it is loaded into RAM, when you edit a function, that change is not loaded into RAM until a call to the new function is made. To get MATLAB to recognize your edited function, type clear functions to clear all functions, or clear
When you write an M-file in MATLAB, you can either write a script or a function. The difference is that a script is read from the disk and parsed line by line each time it is called. A function is loaded into RAM for execution. Because it is loaded into RAM, when you edit a function, that change is not loaded into RAM until a call to the new function is made.