필터 지우기
필터 지우기

Referring to an element within a cell array element

조회 수: 4 (최근 30일)
Ali Kiral
Ali Kiral 2022년 11월 2일
댓글: Ali Kiral 2022년 11월 2일
x{1}=[1;2;3];
for i=1:4
x{i+1}=x{i}+5;
end
The above small script generates a 1x5 cell array. Every element of x is a 3x1 array. I can see the contents of x using celldisp, for example x{3}=[11;12;13]. Now how do I address, for example, 12, the second element of third element of x?

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 11월 2일
%pre-allocation
x=cell(1,5);
x{1}=[1;2;3];
for i=1:4
x{i+1}=x{i}+5;
end
value=x{3}(2)
value = 12

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by