필터 지우기
필터 지우기

How to label a structure name in a loop

조회 수: 5 (최근 30일)
Regan Kubicek
Regan Kubicek 2022년 10월 3일
답변: Chunru 2022년 10월 3일
I've created a cell called low that has structures (t1, t2, t3.....) I would like to change the 1,2,3 in a for loop
what works manually.....
data = (low{1}.t1(:,1))
what I want looping
for i=1:5
data = (low{1},t'i'(:,1))
end

답변 (1개)

Chunru
Chunru 2022년 10월 3일
low.t1 = 2;
low.t2 = 3;
for i=1:2
data = low.("t"+i)
end
data = 2
data = 3

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by