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');

 採用された回答

KSSV
KSSV 2022 年 3 月 5 日
編集済み: KSSV 2022 年 3 月 5 日

0 投票

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 件のコメント

Santosh Sangale
Santosh Sangale 2022 年 3 月 5 日
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;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

製品

リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by