how to plot matrix

86 views (last 30 days)
Fatma Nur Disci
Fatma Nur Disci on 24 Dec 2020
Commented: Deeds on 3 Jan 2021
Hi all,
I have 2304x1024 matrix. I assume that each 3 rows of this matrix describe an image.(so I have 768 images and each image size = 3x1024 ). And want to plot it.
Can anyone help me with this please?

Answers (2)

Subhadeep Koley
Subhadeep Koley on 24 Dec 2020
This code snippet extracts out the first image and plots it. Similarly you can extract the other images.
% Defining a random matrix for demo
matrix = rand(2304, 1024); % Use your matrix here
% Extract first 3 rows
image1 = matrix(1:3, :);
% Visualize
Fatma Nur Disci
Fatma Nur Disci on 29 Dec 2020
Thanks I tried it, just gives me one picture.
I need to see 768 images seperately in a single figure(or table, window. I don't know what it is called.).
From image1 to image 768.

Sign in to comment.

Deeds on 24 Dec 2020
Edited: Deeds on 24 Dec 2020
Let your 2304x1024 matrix be data. I'm assuming that you have to obtain these images successively in a single plot. If that is not the case, please specify how do you actually want to plot it.
for i=1:3:size(data,1)
for j=1:size(data, 2)
image(1,j) = data(i,j);
image(2,j) = data(i+1,j);
image(3,j) =data(i+2,j);
hold on;
Hope that helps!
Deeds on 3 Jan 2021
Hi Fatma,
Sorry for the late reply. I hope this can resolve your issue.
position =1;
for ind=1:768
start= (ind-1)*3+1;
data = wholedata(start:stop,:);
hold on;
position = position+1;
Further, you can even use imshow and subplot for your functionality. I have never used it personally, so I'll just share the link where you can find more information on its impementation. Link!
Hope that helps!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!