필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Subscripted assignment dimension mismatch Error, How to find the cause?

조회 수: 1 (최근 30일)
Chameleon17
Chameleon17 2015년 10월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
Good afternoon,
I'm stuck again on what I think is a minor problem but I can't seem to figure how to get around it.
I keep getting the Subscripted assignment dimension mismatch.
Error in CR (line 168) LOC7(2:4,k) = OB(1,idx)
Loc7 is 4 x 37 double and OB is 2 x 37 double.
k should run to 37 but keeps stopping at fourteen.
I've used this method on other data and it works fine, I'm confused about where/ why and how to fix this error.
Any suggestions or thought are very much appreciated!
Thank you for any time you can spare!!
LOC7 = LOC6;
for k = 1:size(OBLOC6,2)
if LOC6(1,k)~=0
[idx] = find(OB(2,:)==LOC6(1,k))
if ~isempty(idx)
if LOC7(2,k) == 0
LOC7(2:4,k) = OB(1,idx)
end
end
end
end
  댓글 수: 1
Jan
Jan 2015년 10월 26일
Please use code formatting and avoid leading spaces for standard text. I've edited your question to improve the readability this time.

답변 (1개)

Jan
Jan 2015년 10월 26일
If idx is not a scalar this line must fail:
LOC7(2:4,k) = OB(1,idx)
Then you have a [2 x 1] array on the left hand side, and a [1 x N] vector on the right.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by