R.matlab icon indicating copy to clipboard operation
R.matlab copied to clipboard

fieldnames in nested structures lost

Open ashenkin opened this issue 6 years ago • 6 comments
trafficstars

Hi Henrik,

Thanks for the useful package! i'm having an issue where nested structure fields aren't being imported with their names. Mat file is here: https://www.dropbox.com/s/ls8jzre5dyvf6xu/rmatlab_example.mat?dl=0. Any help greatly appreciated!

Thanks, Allie

> library(R.matlab)
> matstruct = readMat("rmatlab_example.mat")
> names(matstruct$qsm)
NULL

image

ashenkin avatar Feb 08 '19 15:02 ashenkin

Any news on this front?

stefanocoretta avatar Mar 03 '20 21:03 stefanocoretta

Sorry, not on my end. I don't actively develop R.matlab but PRs (code coupled with solid test scripts) are welcome.

HenrikBengtsson avatar Mar 03 '20 21:03 HenrikBengtsson

use 'rmatio' instead

yananzhaotpg avatar Mar 06 '20 01:03 yananzhaotpg

An update. I realised that field names are not dropped. MATLAB structs are read into R as 3-dimensional arrays and the content of the struct is in the first element of the 3rd dimension. Field names are retained as dimension names of the first dimension.

I’ll add a reproducible example later.

rmatio does not currently work for me (see issue here).

stefanocoretta avatar Mar 06 '20 05:03 stefanocoretta

@stefanocoretta can you please give a reproducible example please ? OR maybe a PR

boral avatar Jan 06 '23 07:01 boral

Hi @boral, unfortunately not because I am not using MATLAB any more.

stefanocoretta avatar Jan 06 '23 15:01 stefanocoretta