Reputation: 3306
In MATLAB I'm using a couple of java routines I've written to interface with a MyQSL database. One routine returns a boolean value
result <1x1 java.lang.Boolean>
>> result
result =
true
When I then use it in a conditional statement I get an error message.
>> if result,
disp('result is true')
end
??? Conversion to logical from java.lang.Boolean is not possible.
Is there a way to use the java boolean class as a MATLAB logical type? Or do I have to resort to returning integer values from my java routines?
Upvotes: 7
Views: 946
Reputation: 124563
Example:
b = java.lang.Boolean(true);
if b.booleanValue
disp('val is true')
else
disp('val is false')
end
And to make sure:
>> v = b.booleanValue;
>> whos v
Name Size Bytes Class Attributes
v 1x1 1 logical
Upvotes: 8