MatFileHandler icon indicating copy to clipboard operation
MatFileHandler copied to clipboard

Multidimensional arrays

Open miloush opened this issue 3 years ago • 2 comments

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.

miloush avatar Jul 09 '21 11:07 miloush

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

  • double[,]? ConvertTo2dDoubleArray();
  • Array? ConvertToMultidimensionalDoubleArray();

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.

mahalex avatar Jul 10 '21 10:07 mahalex

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.

miloush avatar Jul 15 '21 20:07 miloush