error in storing variable

조회 수: 3 (최근 30일)
kash
kash 2012년 3월 8일
I an performing dualtree transform,i have completed dual tree performed some operation and i have 10 matrices in each variable,now i f
for j = 1:J
for s1 = 1:2
for s2 = 1:3
a1{j}{s1}{s2}=a1;
end
end
end
if i use a1{j}{s1}{s2} i get error as
Cell contents assignment to a non-cell array object.
Error in ==> ssample at 35
a1{j}{s1}{s2}=a1;
if i use
w1{j}{s1}{s2}=a1;
the size of a1 is {1x2} {1x2},w1 is {1x2}
if i use
w{j}{s1}{s2}=a1;
i get correct answer as
{1x2} {1x2}
i want to store in different variables in order to perform idualtree ,please help
  댓글 수: 1
Jan
Jan 2012년 3월 8일
Are you really sure, that you need a cell of cells of cells? This is possible, but not common. Would a [j, s1, s2} cell satisfy your needs?

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

답변 (1개)

Walter Roberson
Walter Roberson 2012년 3월 8일
Examine
a1{j}{s1}{s2}=a1
Notice that you have the same variable name on the left and right hand side, so you are attempting to store a copy of the entire cell array into an element of the cell array. Are you sure that is what you want?
  댓글 수: 2
kash
kash 2012년 3월 9일
walter can u tell why i get error if i store in another variable i have to store in another variable because i have to process inverse dualtree,i want to store in another variable,cecause i have 10 matrices and i need ti display 10 images
Walter Roberson
Walter Roberson 2012년 3월 9일
In what you described in your Question, you get the error when you try to store a1 in to part of a1, and you do not get the error when you store a1 in to part of some other variable. That is the opposite of what you describe now, in which you say you get an error if you "store in another variable".
At least one of us is confused.

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

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by