How can I declare a string variable which I can call when loading a filename?
6 views (last 30 days)
Show older comments
Maria Py
on 25 Jul 2016
Commented: Azzi Abdelmalek
on 25 Jul 2016
I want to plot files amongst which the only thing that changes is a word. Therefore, I want to declare a variable which I can call in the filename. Model=(CanESM); load('Model.mean.dat'); ...
0 Comments
Accepted Answer
Azzi Abdelmalek
on 25 Jul 2016
Edited: Azzi Abdelmalek
on 25 Jul 2016
model='Model.mean.dat'
load(model);
3 Comments
Azzi Abdelmalek
on 25 Jul 2016
Model='CanESM';
file=sprintf('%s.mean.dat',Model)
load(file)
More Answers (0)
See Also
Categories
Find more on String Parsing 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!