필터 지우기
필터 지우기

for loop append variable

조회 수: 6 (최근 30일)
il147
il147 2022년 2월 18일
댓글: il147 2022년 2월 22일
i'd like to append variable n0 to n1
but this code made just last variable
Thanks!
leng=length(list)
n0=[]
for i=1:leng
nl=list(i).name
end
  댓글 수: 6
Stephen23
Stephen23 2022년 2월 18일
That is why I showed you this approach:
{list.name}.'
Much simpler than a loop.
il147
il147 2022년 2월 18일
It works!!!! Thanks for your help!!

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2022년 2월 18일
편집: KSSV 2022년 2월 18일
You can make it a cell array.
leng=length(list)
nl = cell(leng,1) ;
for i=1:leng
nl{i}=list(i).name
end
You may access n1{1}.........n1{10}
  댓글 수: 3
KSSV
KSSV 2022년 2월 18일
You can do the same as shown above. Store them into a cell array.
il147
il147 2022년 2월 22일
Do you have any idea to make it matrix form not cell array?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by