MATLAB: How to get values ​​from a column based on the values ​​of other columns

arraycolumnsdatasetrows

Hi,
I ordered a set of data as in the example below:
A B C D E F G J
,1985,04,10,1800,4,140,1, 2.0,
,1985,04,11,0900,4,999,1, 0.0,
,1985,07,09,0300,4,999,1, 0.0,
,1985,04,11,2100,4,020,1, 5.0,
,1987,03,03,1000,4,360,1, 10.0,
,1987,03,03,1100,4,360,1, 10.0,
,1987,01,03,0700,4,360,1, 8.0,
,1987,01,03,0900,4,360,1, 7.0,
,1987,03,03,1200,4,360,1, 10.0,
,1987,03,03,1300,4,360,1, 10.0,
,1985,07,09,1500,4,180,1, 10.0,
,1985,07,09,1800,4,180,1, 11.0,
,1985,07,10,0600,4,160,1, 3.0,
,1985,07,10,1000,4,180,1, 4.0,
,1985,04,11,1500,4,360,1, 9.0,
,1985,04,11,2000,4,050,1, 5.0,
,1985,07,10,1200,4,180,1, 5.0,
,1985,07,10,1500,4,180,1, 6.0,
,1987,01,03,0600,4,360,1, 8.0,
,1987,01,03,1100,4,360,1, 6.0,
,1985,07,09,0600,4,999,1, 0.0,
,1985,07,09,1200,4,180,1, 6.0,
,1987,01,03,1300,4,360,1, 6.0,
,1987,01,03,1600,4,360,1, 7.0,
,1987,01,03,1900,4,360,1, 6.0,
,1987,03,03,0500,4,020,1, 8.0,
,1987,03,03,0900,4,360,1, 10.0,
,1987,01,03,1400,4,320,1, 5.0,
,1987,03,03,1500,4,360,1, 10.0,
I want to create an array with the values in column "J" based on the values in column "B". . For example the vector Z should contain only the values of "J" that are on the same row with the value "01" in column "B", vector X only the "03" and so on …
Thanks in advanace for the help and suggestions.

Best Answer

Are A...J cell arrays with strings or numeric arrays?
If you have numbers, this should do the job:
Z=J(B==1);
If it's cell arrays with strings, you need:
Z=J(strcmp(B,'01'));
Best regards,
Michael