Menu

#5 support for MLEmptyArray when saving mat file

1.0
wont-fix
nobody
None
2015-01-09
2014-01-21
Diego
No

Hello,

I need to create empty variables in a mat file.

I've tried as follows:

MatFileWriter mfw;
matDataStream = new List<mlarray>();
matDataStream.Add(new MLEmptyArray("a"));
mfw = new MatFileWriter("test.mat",matDataStream,true);</mlarray>

This code generates a System.InvalidCastException when trying to write the file, because it is impossible to cast an object of type 'csmatio.types.MLEmptyArray' to 'csmatio.types.MLNumericArray`1[System.Double]'.

Any suggestions?

Thanks again for your support!

Related

Discussion: Writing structure array with empty field

Discussion

  • Tobias

    Tobias - 2014-01-21

    I took a short look into the code and I am not sure what the purpose of the "MLEmptyArray" class really is. csmatio uses it only when creating empty members of Matlab struct and cell variables but not for standalone Matlab variables.

    I would suggest that you create empty variables like this:

    ~~~~:::matlab
    MLArray arr = new MLDouble("a", new int[] { 0, 0 });
    ~~~~

    Would that work for you?
    Tobias

     
  • Tobias

    Tobias - 2014-10-15
    • status: open --> wont-fix
     
  • Tobias

    Tobias - 2014-10-15

    It seems to me that MLEmptyArray wasn't designed to be used that way so I won't consider that a bug.

     

Log in to post a comment.

MongoDB Logo MongoDB