필터 지우기
필터 지우기

Info

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

subscript assignment dimension mismatch solutions

조회 수: 1 (최근 30일)
CLARK KENDRICK GO
CLARK KENDRICK GO 2018년 2월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I am writing into a variable Q(:,:,:) in an iteration. The first iteration stores into Q(:,:,1) a matrix of 463x2. Each succeeding iteration has one less row but same number of columns. Hence, Q(:,:,2) will have 462x2 and so on. I got the error message: subscript assignment dimension mismatch. And it took me quite some time to realise this was the reason. How do I remedy this?

답변 (1개)

Guillaume
Guillaume 2018년 2월 26일
Since matrices can't have empty elements you can't store your iteration results into a 3D matrix. Yo u could use a cell of 2D matrices instead:
Q = cell(1, numiterations);
for iter = 1:numel(iter)
%...
Q{iter} = some2Dmatrix
end

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

Community Treasure Hunt

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

Start Hunting!

Translated by