Can I run 2 or more matlab scripts (each running in a separate matlab session) using the same data in a folder without them interfering with each other?
Show older comments
I have a set of database (multiple *.mat files) collected in a folder, which I can recall in a subsequent run. Let say I have n=100 mat files, and each *.mat file contains a set of matrices and vectors, say M and V. In such a subseq. run, computation will be performed for cases "n_i=1:100" subsequently, and M and V will be loaded for every "n_i". Would it be possible to run multiple scripts, each running a subsequent run? If script A is running n_i=3, and script B, running in the same folder, is running n_i=10, would M and V loaded by script A, replaced by the ones loaded by script B? Or are they compartmentalized in each script?
Thank you in advance.
2 Comments
Stephen23
on 19 Jun 2024
"Or are they compartmentalized in each script?"
Scripts are not "compartmentalized" at all. They are wild, uncontrolled, und unpredictable.
The solution is better code:
- write functions (not scripts)
- always LOAD into an output argument.
Simple steps that make your code much more robust, reliable, and repeatable.
Hendrawan Aji
on 19 Jun 2024
Accepted Answer
More Answers (0)
Categories
Find more on Database Toolbox 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!