mahalex / MatFileHandler

MATLAB .mat-file reading/writing API for .NET Standard
MIT License
40 stars 12 forks source link

Multidimensional arrays #20

Open miloush opened 3 years ago

miloush commented 3 years ago

Would it be possible to have a functions similar to IArray.ConvertToDoubleArray returning arrays of the right dimensions? Currently one needs to know how the file format orders multidimensional data into single dimensional array in order to be able to use it.

mahalex commented 3 years ago

Thanks for opening the issue! I added the following methods to IArray:

The 2-dimensional case is probably the most common, so I feel that it deserves an explicit method. The update is published on nuget.org as version 1.4.0-beta1. Please see if the API is suitable for you. I guess I will do the same for ConvertToComplexArray() later.

miloush commented 3 years ago

I used ConvertToMultidimensionalDoubleArray and its working as expected (my array is 3D). thank you!

I would argue that ConvertToMultidimensionalDoubleArray() as double[,]? is simple enough to not add extra API, but if you go for it I think it should be called 2D rather than 2d, all classes in the framework are 2D and/or 3D with capital D.