Help with Array Induces (left and right side are incompatible)

The following code: ...
Gets me the error
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Error in Title_here (line 40)
k(j)=B(1,:);
If I need the code to save each loop of n results to later make an histogram of all the results of said loop m times. then how should I do it so it works?

 채택된 답변

madhan ravi
madhan ravi 2018년 11월 5일
k = cell(1); % before loop
k{i}=B(1,:) %change this

댓글 수: 1

It is good practice to preallocate the cell array to the correct size before the loop.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2018년 11월 5일

댓글:

2018년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by