How to plot (over one figure) one variable from each table located in 20 diffrent folders?
Ältere Kommentare anzeigen
Hi all,
I have 20 folders. In each folder there is a table. Each table contains variable 'x'. I would like to plot variable x from all folders over one figure. Some of my dirty logic below:
Step 1: I can so far list all folders:
% List all folders
topLevelFolder = pwd;
files = dir(topLevelFolder); % Get a list of folders in this folder.
dirFlags = [files.isdir];
subFolders = files(dirFlags); % Extract only those that are directories.
subFolders(1:2) = [];
Step 2: Next, I think I should list all tables from which variable x will be accessed
%%List all desired tables
for k = 1:length(subFolders)
all_tables = dir(fullfile(subFolders(1),'*_Cycles.mat')); % subfolder (1) beacuse the table I want to access in first on the list
end
Error using fullfile (line 67)
All inputs must be strings, character vectors, or cell arrays of character vectors.
Step 3: if step 2 works , I think I should load each table in a loop, load variable x, and plot in over one figure
%%Load each table, access variable x, and plot in over one figure
for k = 1:length(all_tables)
disp(all_tables(k).name)
A = fullfile(subFolders,all_tables(k).name);
variable_X = load(A);
end
Step 4: how to plot the x variable ?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Tables finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!