필터 지우기
필터 지우기

opening structure in a loop

조회 수: 1 (최근 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