How to create for loop for more than 1 file in path?

3 views (last 30 days)
Hi everyone, I'm currently trying to analyze all 6 data and have them all on 1 plot. I'm not sure what to put in my for loop that can go through each of the 6 files that I have in paths, and each of the file have a different name, color, and length style
Thank you for all your help!

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 20 Mar 2022
You exercise can be solved using a simple for loop, e.g.:
G = ["C:\...\ANOVA.xlsx";
"C:\...\Data.xlsx";
"C:\...\DAT1.xlsx";
"C:\...\DAT2.xlsx";
"C:\...\D_Excel.xlsx";];
for ii = 1:numel(G)
winopen(G(ii)); % Open/View all files
ALL{ii} = readmatrix(G(ii)); % Get all data from the files
...
end

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!