Plotting the first column of each page on one plot
2 views (last 30 days)
Show older comments
I have a matrix (101x11x8). An example of my data is attached 'Example.mat' and I am using MATLAB R2020a.
I want to plot the 1st column of every page (the third dimension of the matrix) on the same plot (and subsequently the 2nd column of every page on the same plot etc.). My first thought was to use the hold on function, but that doesn't seem to work. Here is what I have tried so far:
for i = size(H_Amputated,3)
plot(H_Amputated(:,1,i))
title('Ankle Angle')
hold on
end
This gives me the following image, which is the column from the last page so it doesn't appear that the hold on function is doing what I want it to:
Any ideas of how to plot the 1st column from each page on the same plot?
Thanks in advance.
0 Comments
Accepted Answer
Mathieu NOE
on 20 May 2021
hello
simply because your not really doing the loop from i = 1 to 8
this is wrong :
for i = size(H_Amputated,3)
this is right
for i = 1:size(H_Amputated,3)
legend added for my fun ! - have a good day !!
figure(1);
for i = 1:size(H_Amputated,3)
H_Amputated(:,1,i)
plot(H_Amputated(:,1,i))
title('Ankle Angle')
hold on
legstr{i} = (['Data ' num2str(i)]);
end
legend(legstr);
0 Comments
More Answers (1)
Girijashankar Sahoo
on 20 May 2021
%% here is i am taking an example might be helpful to you
%% I take take 3D matrix, here 8 number of page, each page has 11 coloumn and each coloumn has %% 101 element. I just plot 101 elemnet as single curve and In same figure 8 number number of graph
%% from each page. In this manner for 11 coloumn there is 11 graph will create
clc
clear all
M=rand(101,11,8);
for j=1:11
figure
for k=1:8
plot(M(:,j,k))
hold on
end
end
0 Comments
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!