Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Matrix Dimensions must agree

1 visualizzazione (ultimi 30 giorni)
Gaurav Mathur
Gaurav Mathur il 14 Lug 2019
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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';

Risposte (1)

dpb
dpb il 14 Lug 2019
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