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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by