Looping Structrures with a Name

조회 수: 3 (최근 30일)
Amanda
Amanda 2013년 5월 9일
I'm trying to loop over a structure. I have a Structure A with field names: State, Tornado, and Hurricane. So what I currently have is the following:
for n=1:numel(A)
name(n) = S(n).Tornado
name(n) = S(n).Hurricane
end
What I'm trying to achieve is a NAME: name(1),name(2),name(3) of each data set, so I can acess all the data sets after the loop has completed.
Thanks,
Amanda

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 9일
name1={S.Tornadoname}
name2={S.Hurricane}

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by