Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

writeNPY.m 549 B

1234567891011121314151617181920212223
  1. % NPY-MATLAB writeNPY function. Copied from https://github.com/kwikteam/npy-matlab
  2. function writeNPY(var, filename)
  3. % function writeNPY(var, filename)
  4. %
  5. % Only writes little endian, fortran (column-major) ordering; only writes
  6. % with NPY version number 1.0.
  7. %
  8. % Always outputs a shape according to matlab's convention, e.g. (10, 1)
  9. % rather than (10,).
  10. shape = size(var);
  11. dataType = class(var);
  12. header = constructNPYheader(dataType, shape);
  13. fid = fopen(filename, 'w');
  14. fwrite(fid, header, 'uint8');
  15. fwrite(fid, var, dataType);
  16. fclose(fid);
  17. end