How to Use Column Values for Plotting in Matlab?

  • Context: MATLAB 
  • Thread starter Thread starter joanne34567
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
joanne34567
Messages
12
Reaction score
0
So I have a dataset...
I am trying to use let's 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?
 
Physics news on Phys.org
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.