accessing data from 1st row to nth row from two columns and plotting them

11 views (last 30 days)
1

Accepted Answer

Ameer Hamza
Ameer Hamza on 9 Mar 2020
Edited: Ameer Hamza on 9 Mar 2020
You can use the indexing to specify the the rows and columns you want to extract.
data = rand(20, 5); % example matrix
x = data(2:end, 1); % row 2 to 15 from column 1
y = data(2:end, 2); % row 2 to 15 from column 2
plot(x,y);
The above code will extract row 2 to 15 from column 1 and row 2 to 15 from column 2 and plot them.
  3 Comments
Ameer Hamza
Ameer Hamza on 9 Mar 2020
Sousheel Pappu, check the edited answer. You can use end to indicate the last row in the column.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!