Error using plot comand

1 visualización (últimos 30 días)
george korris
george korris el 7 de Abr. de 2021
Comentada: george korris el 7 de Abr. de 2021
Hello guys i have the next code
clc;
clear all;
img = imread('1.jpg');
img = imcrop(img)
Y = abs(fft( mean( imrotate(img,30) ,1) ));
figure
plot(Y)
and when i run it i get the next error does anyone know why?
Error using plot
Data cannot have more than 2 dimensions.
Error in aa (line 8)
plot(Y)

Respuesta aceptada

DGM
DGM el 7 de Abr. de 2021
Editada: DGM el 7 de Abr. de 2021
img = imread('1.jpg');
img is a MxNx3 image. If you expect it to be MxNx1, flatten it in an appropriate manner.
Y = abs(fft( mean( imrotate(img,30) ,1) ));
now Y is a 1xPx3 array. plot() won't know what to do with that. You could squeeze or permute it into 2D
plot(squeeze(Y))
or you could just plot one channel at a time
plot(Y(:,:,1))
  1 comentario
george korris
george korris el 7 de Abr. de 2021
i think this is what i want ,thank you DGM!!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by