I wrote a script in python, using matlab engine to be able to use write_mrtrix.m and read_mrtrix.m. This works perfectly fine when running in jupyter notebook, no problems at all. I want to make it easy to use for others by turning it into a python file that can be run from the command line, also specifying input and output files in the command line. But when I run it from the command line I get this error:
Error using fprintf
Function is not defined for ‘cell’ inputs.
Error in write_mrtrix (line 78)
fprintf (fid, ‘\ncomments: %s’, image.comments)
I don’t know much about matlab, I have tried commenting out that part of the write_mrtrix.m code but using it then created a useless mrtrix file. I have also tried turning the mrtrix files into nifti files and using Nibabel to import the files to python, also didin’t work because of too large dimensions (498511, 1, 1). It is a fixeldata file.
read_mrtrix gives a lot of ‘unknown key’ when I run it, but other than that it seems to work.