Generated "*.m" file could not be real time updated

hello:
As showed in figure. I have a 'main.m' file, which feature is read external files and generate 'a.m' file, then run 'a.m'. I found that, after run('a.m') on 'Step 2', the resault represent that ‘a.m’ is not newest. After run 'main.m', when I check 'a.m', it is newest.
My question is there any way to run newest 'a.m' in 'main.m'.
Thank you.

 Accepted Answer

For performance MATLAB caches executed functions and scripts. To clear that script from the cache call CLEAR:
filename = 'a.m';
clear(filename)
run(filename)

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Release

R2022b

Tags

Asked:

on 9 Feb 2026

Commented:

on 9 Feb 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!