Info

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

Matrix Dimensions must agree

조회 수: 1 (최근 30일)
Gaurav Mathur
Gaurav Mathur 2019년 7월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
I am getting this error at line 25 for the code:
clc
clear all
i=1;
b=int64(nan(848,896));
c=int64(nan(848,896));
for i=1:9999
if i<10
new="0000";
elseif i<100
new="000";
elseif i<1000
new="00";
elseif i<10000
new="0";
end
i2=new + num2str(i);
path='C001H001S00040'+i2 + '.tif';
a=int64(imread(path));
disp(i2)
i=i+1;
b=b+a;
end
for k=10000:15068
i3=num2str(k);
path_new='C001H001S00040'+i3 + '.tif';
a=int64(imread(path_new));
disp(i3)
k=k+1;
c=c+a;
end
b=(b+c)/15068;
b=uint8(b);
imshow(b)
Error:
Error in new_code (line 25)
path_new='C001H001S00040'+i3 + '.tif';

답변 (1개)

dpb
dpb 2019년 7월 14일
The + operator only works for the class string catenation, not character strings.
path_new="C001H001S00040" + i3 + ".tif";
and will still only work if i3 is also of class string.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by