what is the problem?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
i have a loop that every time insert a vector in one row of a matrix but when i assign it i give this error massage :Index exceeds matrix dimensions. this is my code for assigning :
ps{psize,pcol}=cl{1,pcol};
that psize is 500 and pcol is 15
댓글 수: 1
Image Analyst
2013년 12월 30일
Please give the entire error message, that means ALL the red text, not just some of it. I want to know if it's failing at the very last, lower right element of each, in other words
ps{500,15} = cl{1,15};
or if you're trying to assign some other elements, like cl{2,42} or something. The error message should say how many elements there are in the arrays.
답변 (1개)
Azzi Abdelmalek
2013년 12월 30일
0 개 추천
Check the sizes of ps and cl, and check if they are not less than pcol and psize
댓글 수: 2
fatemeh
2013년 12월 30일
Walter Roberson
2013년 12월 30일
At the MATLAB command line, give the command
dbstop if error
and run the program. When it stops, examine
size(cl)
pcol
I suspect you will see cl being smaller than you expect.
Question: why not use
ps(psize, pcol) = cl(1, pcol);
That would be less internal work. This will not make a difference to the array index error you are getting, but it is generally safer.
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!