how to write more than one time in the same cell in cell array ?

조회 수: 1 (최근 30일)
Meme
Meme 2014년 5월 11일
편집: Meme 2014년 5월 11일
how to write more than one time in the same cell in cell array ? for example if i have a for loop that writes 1 in cell i want to loop again then write 2 beside one in the same cell in the cell array so the cell will be {1,2} and so on ?
hop1=cell(5,5);
for i=1:5
for j=1:5
if direct{j,i}==0
for s=1:5
if direct{j,s}==1
if direct{s,i}==1
temp= hop1{j,i};
hop1{j,i}=[temp; userCon.ID(s)];
end
end
end
end
end
end
in this part : temp= hop1{j,i}; hop1{j,i}=[temp; userCon.ID(s)]; end i thought that this will make me able to write more than one element in the same cell but it didn't work.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 11일
A={1 2 3}
A{1}(2)=4

카테고리

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