Hi,
I have a matrix 3 by 862 representing the results of 5 samples stacked vertically. The samples are all of different sizes. The columns are 1) Sample ID (ID), 2) Depth (D) and 3)Turbidity (T). eg.
ID D T- - -- - -n n n
I would like to extract the 5 samples into their own matrices using the first column ID to separate them similar to the Vlookup function in excel so I can then conduct subsequent calcs. I know how to manually extract samples, using:
S1=ID==1;D1=D(S1);T1=T(S1);Summary=[D1 T1]
To extract sample 1, however, I am looking for a way to automate this. i.e. extract all the samples at the same time and ideally the ability to handle different numbers of samples. I think I need to loop, but can not get it to work and am becoming confused because not other examples that I have found rely on using one column (ID in my case) to separate and then extract other data based on this.
Thanks Matt
Best Answer