opening structure in a loop

2 visualizzazioni (ultimi 30 giorni)
Rica
Rica il 11 Nov 2014
Risposto: Julia il 11 Nov 2014
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

Risposta accettata

Julia
Julia il 11 Nov 2014
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

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by