Convert from Matlab logical to double
If you see the following error message in Matlab,
First and second arguments must be single or double.
you need to convert logical values to float using double command before operating on them.
>> x = [-1 1 0] > 0; y = double(x);
>> whos x y
Name Size Bytes Class Attributes
x 1x3 3 logical
y 1x3 24 double