how do i select a line but not all ?

2 views (last 30 days)
i need a help
how do i write a code when i want to use a certain number in line.. for example i have this set of solutions
RS =
1 29374 11 6 5 7 1 4 3 10
2 33444 10 2 4 6 7 1 3 8
3 38346 3 7 12 8 4 10 11 9
4 39010 3 10 1 7 11 5 4 8
5 41420 12 11 7 5 1 6 9 8
6 44168 12 10 4 6 3 5 11 7
7 46220 2 11 6 5 12 3 9 8
8 47074 8 11 1 7 5 4 6 2
9 51854 7 8 2 5 1 12 11 4
10 52194 7 9 2 5 11 1 10 3
i want to choose line 1 and 2 and 9 and 10 so i did it like this
P1 = RS(1,:)
P2 = RS(2,:)
P3 = RS(9,:)
P4 = RS(10,:)
from this i get my answer like this
P1=
1 29374 11 6 5 7 1 4 3 10
P2=
2 33444 10 2 4 6 7 1 3 8
P3=
9 51854 7 8 2 5 1 12 11 4
P4=
10 52194 7 9 2 5 11 1 10 3
however i only want to used from line 3 until last
how do i code that to that i just get my answer like this
P1=
11 6 5 7 1 4 3 10
P2=
10 2 4 6 7 1 3 8
P3=
7 8 2 5 1 12 11 4
P4=
7 9 2 5 11 1 10 3
can someone help me?

Accepted Answer

Cris LaPierre
Cris LaPierre on 14 Nov 2018
I would suggest going through chapter 5 of MATLAB Onramp. It shouldn't take too long and would really help you out.
In the meantime, the short answer is to include in your command the range of data you want to extract:
P1 = RS(1,3:end)
...

More Answers (1)

Community Treasure Hunt

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

Start Hunting!