Make a plot using value from a certain line of matrix

1 view (last 30 days)
Suppose I have a matrix of dimension 10x10. Now I want to use the value along the column 5 as Y axis, and use the index of rows to represent x increment, how can I make a plot like that in Matlab? And at the same time, when I do the contour plot of a matrix, is it a way to indicate the highest and lowest value in the contour plot?

Accepted Answer

Massimo Zanetti
Massimo Zanetti on 8 Oct 2016
Edited: Massimo Zanetti on 8 Oct 2016
Herre it is:
%define a 10x10 matrix
%plot its 5th column with index as x axis
%detect min and max
%add them to plot
hold on;
hold off;
dpb on 8 Oct 2016
NB: that this is 5 th row, not's row 5, all columns; the indices are reversed regarding the question posed.

Sign in to comment.

More Answers (1)

dpb on 8 Oct 2016
  1. plot(Y(:,5))
  2. clabel(C,h,[v(1) v(end)])


Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!