To get an int64
value from a Java method that returns a long
, you can use the longValue()
method of the Long
class to convert the Long
object to a long
value, and then cast it to an int64
value. Here's an example:
% Load the Java class that contains the method you want to call jclass = javaObject('com.example.MyClass'); % Call the method that returns a long value jresult = jclass.myLongMethod(); % Convert the Long object to a long value and cast it to an int64 value matlabResult = int64(jresult.longValue());
In this example, replace com.example.MyClass
with the fully qualified name of the Java class that contains the method you want to call, and replace myLongMethod()
with the name of the method that returns a long
value. The jresult
variable will contain a Long
object, which you can convert to a long
value using the longValue()
method. Finally, you can cast the long
value to an int64
value using the int64()
function in MATLAB.
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.