MATLAB Answers

How to plot specific values from a matrix of 10*10

7 views (last 30 days)
Nadeem Taj
Nadeem Taj on 26 Sep 2021 at 19:36
Answered: the cyclist on 26 Sep 2021 at 20:00
I have a matrix of 10*10 with 5 columns having value >0 and other 5 columns have value=0. I just want to plot the output having values>0. Please suggest me a code. Thanks

Answers (1)

the cyclist
the cyclist on 26 Sep 2021 at 20:00
M = [0 1 0 2;
0 2 0 3;
0 3 0 4];
colsToPlot = not(all(M==0));
figure
plot(M(:,colsToPlot))

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by