Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted?

0
Posted

Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted?

0

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 to clear just your function out of RAM.

0

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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.