Hello guys. Please forgive me if my question seems unclear as i am stiill finding my way through MATLAB. Say, i have a very large matrix , say M=rand(10,3).
M =
0.4464 0.4270 0.5464
0.1115 0.5055 0.2758
0.8828 0.0410 0.4191
0.7399 0.6778 0.9463
0.0032 0.8740 0.1323
0.1920 0.7142 0.4295
0.1379 0.5208 0.9257
0.0943 0.5353 0.8351
0.0390 0.7384 0.9540
0.6558 0.7057 0.4356
I also have some other matrixes which are subsets of the first and second column of M only i.e
C1 =
0.1115 0.5055
0.8828 0.0410
C2 =
0.1379 0.5208
0.0943 0.5353
How do i index into M to extract the third column of M that is equaivalent to elements of C1. i.e expected output should be:
new_C1 =
0.1115 0.5055 0.2758
0.8828 0.0410 0.4191, .
new_C2 =
0.1379 0.5208 0.9257
0.0943 0.5353 0.8351
Also if C1,C2,…Cn are in a cell array, how can i use a for loop to obtain new_C1 and new_C2.
Many thanks
Best Answer