How to use subplot, to plot an image?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey, everyone I am new with MatLab, I tried googling this but no success. I wanted to know, how can I use the subplot function, to plot a line graph of an image X, the value of image X is the difference of image A-B. One being an original image the other the same image with a filter applied. I want to show the difference between them through the new image.
4 Kommentare
Adam
am 12 Okt. 2016
Your problem is with your usage of plot rather than subplot.
You are trying to plot a vector vs an image. I'm not quite sure I understand what you are aiming to do.
To get the image you can use e.g.
imagesc( A );
but what do you want your line to represent? Or are you trying to plot 426 lines, each of length 320 to represent your image data? Or something else?
Antworten (1)
Adam
am 12 Okt. 2016
A = rand(200);
B = rand(200);
D = A - B;
figure;
subplot( 2, 1, 1 )
imagesc( A );
subplot( 2, 1, 2 )
imagesc( D );
would, for example show an original image and the difference image from some other matrix. Obviously with uint8 data you have to be more careful with the difference, but that wasn't what you were asking about anyway I assume.
That is an example of how subplot can work simply though.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!