how do i re-run a script so that it takes the updated information from another script?
18 views (last 30 days)
Show older comments
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 Comment
per isakson
on 17 Aug 2019
Edited: per isakson
on 17 Aug 2019
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.
Answers (1)
Walter Roberson
on 17 Aug 2019
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.
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!