How to Use Column Values for Plotting in Matlab?

  • Context: MATLAB 
  • Thread starter Thread starter joanne34567
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

This discussion focuses on using column values for plotting in MATLAB, specifically how to plot data from one column against another. The user seeks to plot values from column 1 against values from column 6 using the command plot(col(:,1),col(:,6)). It is crucial to ensure that both columns have the same number of elements for successful plotting, as MATLAB requires a one-to-one relationship between the abscissa and ordinate values.

PREREQUISITES
  • Understanding of MATLAB syntax and functions
  • Familiarity with matrix indexing in MATLAB
  • Basic knowledge of data visualization principles
  • Ability to manipulate datasets within MATLAB
NEXT STEPS
  • Explore MATLAB's plot function documentation for advanced plotting techniques
  • Learn about MATLAB matrix indexing to enhance data manipulation skills
  • Investigate how to customize plots in MATLAB, including labels and legends
  • Study data preprocessing techniques in MATLAB to prepare datasets for visualization
USEFUL FOR

This discussion is beneficial for data analysts, MATLAB users, and anyone interested in visualizing datasets effectively using MATLAB's plotting capabilities.

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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
7
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 4 ·
Replies
4
Views
7K