Write Binary UnstructuredGrid CellData LegacyVTK in Matlab

I can’t run your script to test this without some test data, but the Binary part looks generally good. Have you tried using:

fwrite(FID, stuff, 'float');

isntead of: (I don’t think you need the 'b' flag since fwrite already defaults to binary? (my MatLab knowledge is very rusty)

fwrite(FID, stuff, 'float', 'b');

I remember from about a year ago, I was doing similar binary file I/O in MatLab and there being something finicky about fwrite. If you send me a script to create some dummy input data, I could try to test this.

And define the data type as double not float as VTK/ParaView might not know how to handle float data types in the legacy format? Not sure about this…

1 Like