Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Matrix Dimensions must agree

1 visualización (últimos 30 días)
Gaurav Mathur
Gaurav Mathur el 14 de Jul. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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';

Respuestas (1)

dpb
dpb el 14 de Jul. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by