How can I store my data into a 2D array?
조회 수: 2 (최근 30일)
이전 댓글 표시
My code is attached below and it has the "Subscripted assignment dimension mismatch." error
How can I fix this? and how can I store my data into a 2D array? Thanks!
댓글 수: 0
답변 (3개)
Renato Agurto
2015년 12월 16일
Hi. The output of dec2bin is a char not a double. So you should define "out" as a cell:
[m,n] = size(x);
out = cell(m,n);
for i = 1:m
for j = 1:n
out{m,n} = dec2bin(abs(x(m,n)));
end
end
Cheers! Renato
댓글 수: 2
Renato Agurto
2015년 12월 16일
편집: Renato Agurto
2015년 12월 16일
sorry, it should be:
out{i,j} = dec2bin(abs(x(i,j)));
;-)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
