Variable within a Variable
Show older comments
file0=uigetfile;
%further file loadings up to file10
for i=48:57
f=1;
k=char(i);
filename=append('file',k);
load (file0,'ansT');
%file0 is a char named PID_SER[...]
[~, baseFileName, ~] = fileparts(filename);
end
Within the for loop, I want to count up the files to be processed later in the loop (making several plots).
In order to correctly name the plots, I neet to read the title of the file loaded. I get the filename via the fileparts function, while the filename is saved under a char named file0 (created during load). As I need count up the files in each loop, I created the variable filename and appended file with the variable k (as a char).
How do I get the fileparts function so that I get the result if i was to put in the variable file0?
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands 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!