Plotting of a cell array

2 次查看(过去 30 天)
Amit Chakraborty
Amit Chakraborty 2022-6-3
回答: Chunru 2022-6-3
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 !!!!!

回答(1 个)

Chunru
Chunru 2022-6-3
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));

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by