Closed BryanGuillaume closed 4 years ago
It seems that the underlying issue is linked to the order of the fields in a struct array used in a call in the swe_cifti
class. It seems that the order of the fields is important in Octave but not in Matlab.
Indeed the error is thrown in a call like the following:
h = swe_cifti(opt)
where opt
is a struct with three fields ordered as dat
, extras
and hdr
. Simply reordering it in a new struct as follows:
reorderedOpt = struct;
reorderedOpt.hdr = opt.hdr;
reorderedOpt.dat = opt.dat;
reorderedOpt.extras = opt.extras;
and use the reordered struct instead:
h = swe_cifti(reorderedOpt);
seems to work properly.
I am not too sure if the best solution would be to reorder each such struct object as above or to ensure that the original struct is always produced in the expected order. The simplest fix would be however to reorder it when needed and I believe I will go for this solution right now.
This bug has been fixed in PR #166 in this commit.
In Octave, it seems that reading a CIfTI file from data information saved in SwE.mat does not work. For example,
However, simply reading the file by the filename seems to work perfectly. For example,
loads the data correctly.
In Matlab, both ways to read the data seems to work appropriately, meaning that the issue is only specific to Octave.