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

19 views (last 30 days)
安晏
安晏 on 9 Feb 2026 at 2:54
Commented: 安晏 on 9 Feb 2026 at 7:02
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

Stephen23
Stephen23 on 9 Feb 2026 at 6:14
Edited: Stephen23 on 9 Feb 2026 at 6:16
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 Programming Utilities in Help Center and File Exchange

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!