How to assign Nans to specific column, not entire row
10 Ansichten (letzte 30 Tage)
Tanika Bawa am 11 Mär. 2022
I am trying to assign NaNs to values under 0.95, but only for the rows in column 4, not all of the columns.
Before, I used:
ZB1array = table2array(ZB1);
idx = ZB1array(:,4) < 0.95;
ZB1array(idx,: ) = NaN;
This successfully assigned NaNs, but to the entire row. In order to assign them to rows only in column 4 I tried:
ZB1array(idx, ZB1array(:,4)) = NaN;
But this returns the error 'Index in position 2 is invalid. Array indices must be positive integers or logical values.'
Does anyone know what I should do? Thanks!