How does a MATLAB file process a file at runtime?

Suppose you run a script. What happens when you change this file at runtime? MATLAB seems to take a copy of the file and then start to execute it. I want to make sure I'm right. However, I want to run a MATLAB script with various parameters on clusters. Does it work correctly if I make changes to a single file. Or do I need to create multiple copies of the file myself?

+6
source share
2 answers

Changing the contents of the script / function while it is running will not affect the script, since MATLAB runs the (generally) "cached" and "pre-processed" version of the file. As for running a script with multiple parameters in a cluster, I assume you are using the Parallel Computing Toolbox ?

One option would be for the script to load its parameters from the MAT file, allowing you to run the same script for all workers, but work with different parameters.

+6
source

Basically, everything will be okay if you have only one m Matlab file for all your calculations.

But if if the file you are editing is called several times during the calculation, you run the risk of calling several versions of the file by editing it while it is running. More details here: http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/261376

+3
source

Source: https://habr.com/ru/post/908226/


All Articles