How to load variable listed in folder one at a time and run a script sequentially
1 view (last 30 days)
Show older comments
Dear all,
I have different .mat expressions (values) of the same variable VAR in a list of numerical arrays named differently stored in a folder: 'path to folder'\'array name'.VAR I want to import each VAR expression ('array name'.VAR) one at a time, run a script on the VAR value, name the output based on the 'array name' (such as 'array name'.OUTVAR), clear workspace except OUTVAR, then import the next VAR value on the list, run the same script, and iterate down the list. Please advise, I mention that 'array name' is not, say, 'file1', 'file2', but 'mark', 'john'
Many thanks,
Octavian
0 Comments
Accepted Answer
Walter Roberson
on 8 Dec 2013
I suggest that instead of trying to create individual variables in the workspace for each array, that instead you use fields of a structure. For example,
ArrayName = 'mark';
results.(ArrayName) = ....
More Answers (0)
See Also
Categories
Find more on Debugging and Analysis 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!