How I can load multiple data files in workspace?

Hello, I have around 90 Data files that I want to use in my code.
How I can load and store these data files and store in different variables as in following order?
D1=load('Data1');D2=load('Data2');D3=load('Data3');D4=load('Data4');
D5=load('Data5');D6=load('Data6');D7=load('Data7');D8=load('Data8');
D9=load('Data9');D10=load('Data10');
D11=load('Data11');D12=load('Data12');D13=load('Data13');D14=load('Data14');
D15=load('Data15');D16=load('Data16');D17=load('Data17');D18=load('Data18');
D19=load('Data19');D20=load('Data20');

 Accepted Answer

KSSV
KSSV on 5 Mar 2022
Edited: KSSV on 5 Mar 2022
files = dir('Data*') ; % you are in the folder of data files
N = length(files) ;
iwant = cell(N,1) ;
for i = 1:N
iwant{i} = load(files(i).name) ;
end

1 Comment

Hi, can you tell me how i can access particular variable from this data?, because each of this data has struct having four members. now i want to get those values in each different variable from those structs as follows:
A1=D1.v_p_auswertung;A2=D2.v_p_auswertung;A3=D3.v_p_auswertung;
A4=D4.v_p_auswertung;A5=D5.v_p_auswertung;A6=D6.v_p_auswertung;
A7=D7.v_p_auswertung;A8=D8.v_p_auswertung;A9=D9.v_p_auswertung;
A10=D10.v_p_auswertung;

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!