opening structure in a loop

2 ビュー (過去 30 日間)
Rica
Rica 2014 年 11 月 11 日
回答済み: Julia 2014 年 11 月 11 日
hi all, i have this type of data:
% data_1.mat data_2.mat......data_50.mat.
they are structure and contains: as exemple data_1.A =[10x500] data_1.B=[50X500] .
i want to process the data_1....data_50in a loop:
for k=1:50
load (['data_' num2str(k) '.mat'])
*++ +++how could i generate data_(k).A dynamically???++++++++++++++++*
end
thank youall

採用された回答

Julia
Julia 2014 年 11 月 11 日
Hi,
perhaps this helps; it's from the Matlab help:
filename = 'durer.mat';
myVars = {'X','caption'};
S = load(filename,myVars{:})
S =
X: [648x509 double]
caption: [2x28 char]
And then you can access X with
S.X

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by