MATLAB: Finding an output from a matrix using a single syntax

matrix

Hi there guys I have a question. How do you get a single line output out of a matrix? for example here is the matrix:
Q =
10 20 30 40 50 60 70
8 9 10 11 12 13 14
33 30 27 24 21 18 15
28 35 42 49 56 63 70
36 45 54 63 72 81 90
-1 -2 -3 -4 -5 -6 -7
64 69 74 79 84 89 94
and I am required to find:
R = [33 9 30 74 -4 72 63 15]
how do I get it using a single syntax? I've been struggling since I am just new into using Matlab. please help me…

Best Answer

R=[Q(3:6:18) Q(21:6:45)]
Edit, there's one shorter version
R=Q([3:6:18 21:6:49])