Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab indexing within a matrx

  1. Jun 18, 2012 #1
    So I have a dataset...
    I am trying to use lets say values in column 1 to determine which values I need to plot from columns 5 and 6...
    Reading about indexing in a matrix doesn't really help as it doesn't hint at how you might use values in one column to select values from another set of columns and I'm a bit stuck.
    Any ideas?
     
  2. jcsd
  3. Jun 18, 2012 #2
    Plot column 1 with column 6:

    plot(col(:,1),col(:,6))

    Keep in mind that the two columns must have the same size.

    Matlab plots columns in a 1-1 relation, so it will plot the abscissa col(1,1) with the ordinate col(1,6), then the point (col(2,1),col(2,6)), etc.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab indexing within a matrx
  1. Index Notation (Replies: 3)

  2. Index Category (Replies: 1)

  3. Matlab @ (Replies: 1)

  4. Index notation (Replies: 2)

Loading...