Skip to content

Commit

Permalink
Avoid chaining calls to 'subasgn' when writing by indices GIfTI files…
Browse files Browse the repository at this point in the history
… in Octave

This is done by not calling spm_data_write, which chains 'subasgn'  calls, but by explicitely writting the GIfTI file in 2 steps.
  • Loading branch information
BryanGuillaume committed Apr 7, 2020
1 parent a75392a commit 475675c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions swe_data_write.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
V.private.dat(varargin{1}) = reshape(Y,size(varargin{1}))';
end
end
elseif strcmpi(cl, 'gifti') && ~isempty(varargin) && exist('OCTAVE_VERSION','builtin')
D = V.private.private.data{1};
tmp = reshape(Y,size(varargin{1}));
try
D.data(varargin{1}) = tmp;
catch
D.data(varargin{1}) = tmp';
end
V.private.private.data{1} = D;
else
V = spm_data_write(V, Y, varargin{:});
end
Expand Down

0 comments on commit 475675c

Please sign in to comment.