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