Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting CellArray values into java datatype

I'm doing matlab java interfacing using javabuilder. In my matlab code, the function returns a cellarray which is to be casted to java datatype. The value cellarray is retrieved into MWArray. But

I'm not able to cast individual cell data into java datatype.

The cellArray contains string data in each cell. say the cellarray is casted to MWArray 'x' variable. Can any one explain me how to do further casting?

like image 481
Mahesh Gupta Avatar asked Dec 10 '25 13:12

Mahesh Gupta


1 Answers

I've got the answer to this question... the value returned should be casted to MWCellArray and later getCell function should be used to get the cell value which will be MWArray object.

This MWArray is the value returned..

The code will be::

Object[] o = <matlab function called>
MWCellArray x = (MWCellArray)o[0];

MWArray arr = x.getCell(new int[]{1,1});

in my case arr was represeting a String. So, arr.toString() gives the required result .. :)

like image 143
Mahesh Gupta Avatar answered Dec 12 '25 01:12

Mahesh Gupta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!