how do i re-run a script so that it takes the updated information from another script?
15 ビュー (過去 30 日間)
古いコメントを表示
i have 2 scripts open. The first one includes my function. In the second script that calls on my function. If i run the code in the second script and then go back to first script and adjust some of the code, when i go back to second script to run, it doesnt notice the update i made in the first script. The way i have gotten around this is running "clear" and then starting from scratch, but i am assuming there is a cleaner way to do this?
1 件のコメント
per isakson
2019 年 8 月 17 日
編集済み: per isakson
2019 年 8 月 17 日
IMO: Your "program" (/system) shall consist of at most one script (the "main") together with any number of functions. Many collaborating scripts is asking for trouble.
Proposal: Show us your code or better make a minimal working example that illustrates your problem. Then we could try to cast it into a better design.
回答 (1 件)
Walter Roberson
2019 年 8 月 17 日
MATLAB will normally notice changes to .m files that are on the current path, but not if they are installed under the MATLAB installation directory, and not consistently if you are working with a function handle to the function.
Using clear with the name of the function is the official method of dealing with this.
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!