In MATLAB can java boolean value be converted to MATLAB logic?

In MATLAB, I use a couple of java routines that I wrote to interact with the MyQSL database. One routine returns a boolean

result <1x1 java.lang.Boolean> >> result result = true 

When I use it in a conditional expression, 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 boolean type? Or do I need to resort to returning integer values ​​from my java routines?

+7
java mysql boolean matlab
source share
1 answer

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 
+8
source share

All Articles