Plotting of a cell array

3 views (last 30 days)
Amit Chakraborty
Amit Chakraborty on 3 Jun 2022
Answered: Chunru on 3 Jun 2022
For example, I have a data of 4 persons (Say ; a,b,c,d ) which are confined in a cell a array called M. Now I want to plot first 3 persons data in ONE single plot.
I have written the code just want to be confirmed , that my method is correct. So, I writing the code below.
a = rand(12,10);
b = rand( 5, 12);
c = rand( 4, 9);
d = rand( 10, 15);
M = {a,b,c,d}; % Cell Array
p = 3; % for how many persons I want to plot my data
figure;
hold on;
cellfun(@plot,M(:,1:p));
I do not have any syntay error in my code. Just want to check my logic is correct or not !!!
Thank you in ADVANCE !!!!!

Answers (1)

Chunru
Chunru on 3 Jun 2022
a = rand(12,10)+4;
b = rand( 5, 12)+3;
c = rand( 4, 9)+2;
d = rand( 10, 15)+1;
M = {a,b,c,d}; % Cell Array
p = 3; % for how many persons I want to plot my data
figure;
hold on;
cellfun(@plot,M(1:p));

Categories

Find more on Line Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!