Error in matlab Improper assignment with rectangular assignment with rectangular matrix
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
hey matlab friends;
I want to find the locatons of matrixpoints which is given by comtime=[4449,1] from a matrix Tt= [5400,1] and i tried using a function
for kk= 1:4449
loc(kk)=find(Tt=comtime(kk,1))
end
bur an error message which says 'Improper assignment with rectangular assignment with rectangular matrix' keeps coming. What can I do with it? thanks for your help.
댓글 수: 0
답변 (1개)
Tom
2013년 6월 24일
The number of elements you'll find each time will be different, so you can't put them into a standard array. Try using a cell array instead:
loc = cell(4449,1);
for kk= 1:4449
loc{kk}=find(Tt == comtime(kk,1))
end
You can then access each one using the {} notation, e.g.
loc{1}
댓글 수: 8
Ede gerlderlands
2013년 6월 24일
편집: Ede gerlderlands
2013년 6월 24일
Ede gerlderlands
2013년 6월 24일
Tom
2013년 6월 24일
do you know what the answer should be? Can you provide some values for comtime and Tt to test with?
Ede gerlderlands
2013년 6월 24일
편집: Ede gerlderlands
2013년 6월 24일
Ede gerlderlands
2013년 6월 24일
Tom
2013년 6월 24일
And do you know what the answer should be for that data?
Ede gerlderlands
2013년 6월 24일
Jan
2013년 6월 24일
Please consider rounding errors: The decimal comma seems to show, that the data are not written by Matlab. Comparing values like 734869.006944445 exactly can be tricky, because this could be rounded.
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!