I’ve been learning matlab for the past week as my job requires it, but I’m kinda stuck. I want to create a function that removes all data points within lowerBound and upperBound. What’s wrong with this code?
mask = ~((data.HB_X > lowerBound) && (data.HB_X < upperBound));
data.HB_X = data.HB_X(mask);
data.HB_Y = data.HB_Y(mask);
The error is
??? Operands to the || and && operators must be convertible to logical scalar values.
Error in ==> myGUI>deleteHBs at 228
mask = ~((data.HB_X > lowerBound) && (data.HB_X < upperBound));
The problem is exactly what the error message says. You can only use the shortcut operators
&&and||for scalar comparisons. If you compare arrays, you need to use&and|, respectively.