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

 Accepted Answer

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

I guess I was not specific I am sorry about that!
My excel sheets has always random number of rows and they are somwhere in the reange of 700 to 1700 I dont want to always check for the number of rows and enter manually I want the program to do that I mean I want the program to check the last row and access elements untill then!
Thanks in adavnce
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)

Categories

Find more on 2-D and 3-D 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!