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

2 views (last 30 days)
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
M = [0 1 0 2;
0 2 0 3;
0 3 0 4];
colsToPlot = not(all(M==0));
figure
plot(M(:,colsToPlot))

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!