MATLAB: Assigning variable from data file columns with relevance to specific rows.

variable

say I have data with 8 rows and only two columns( 'y' and 'x') and I need to assign a variable to all of the 'x' coulmns values from all of the 'y' columns values that are zero.
Y X
0 23
0 78
1 54
1 25
1 78
0 41
1 89

Best Answer

result = data(~data(:, 1), 2);