Variable within a Variable
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Entering Commands in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!