Error using plot comand

1 view (last 30 days)
george korris
george korris on 7 Apr 2021
Commented: george korris on 7 Apr 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)

Accepted Answer

DGM
DGM on 7 Apr 2021
Edited: DGM on 7 Apr 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 Comment
george korris
george korris on 7 Apr 2021
i think this is what i want ,thank you DGM!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!