Plotting the first column of each page on one plot

1 ビュー (過去 30 日間)
LRW 2021 年 5 月 20 日
回答済み: Girijashankar Sahoo 2021 年 5 月 20 日
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)
title('Ankle Angle')
hold on
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.


Mathieu NOE
Mathieu NOE 2021 年 5 月 20 日
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 !!
for i = 1:size(H_Amputated,3)
title('Ankle Angle')
hold on
legstr{i} = (['Data ' num2str(i)]);

その他の回答 (2 件)

Dyuman Joshi
Dyuman Joshi 2021 年 5 月 20 日
Change your for loop variable
for i=1:size(H_Amputated,3)

Girijashankar Sahoo
Girijashankar Sahoo 2021 年 5 月 20 日
%% 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
clear all
for j=1:11
for k=1:8
hold on


Community Treasure Hunt

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

Start Hunting!

Translated by