Unable to perform assignment because the left and right sides have a different number of elements.
조회 수: 1 (최근 30일)
이전 댓글 표시
i=3;
clmax= zeros(i,1);
for j = 1: 1: i
clmax(j) = del (j).clmax;
end
댓글 수: 5
답변 (1개)
Jan
2021년 6월 30일
편집: Jan
2021년 6월 30일
The error means, that the contents of the fields clmax are not scalar. Check this:
clmax = {del.clmax};
s = cellfun('prodofsize', clmax)
Storing the data in a cell array is the best way, if the fields have different sizes. If call have the same dimension, you can concatenate them to a matrix or a n-dim array:
clmax = cat(1, del.clmax) % Or 2, 3, or what ever
You see, that neither for a cell array nor for a numerical array a loop is required.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!