Help in troubleshooting a code

3 visualizaciones (últimos 30 días)
fiona rozario
fiona rozario el 3 de Mzo. de 2017
Comentada: fiona rozario el 3 de Mzo. de 2017
f=imread('Image.jpeg');
red=f(:,:,1);
[r,c]=size(red)
z=zeros(r,c);
for i=1:r
for j=1:c
z(i,j)=dec2hex(red(i,j))
end
end
This code gives me an error 'Subscripted assignment dimension mismatch.' in line 7. I can't figure out why?

Respuesta aceptada

Alexandra Harkai
Alexandra Harkai el 3 de Mzo. de 2017
dec2hec results in a char array of 1*n for each (i,j) pair, which then would not fit into one element of the numeric array z.
Depends on what you want to use z for, you could consider changing the shape.

Más respuestas (0)

Categorías

Más información sobre NaNs en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by