From 475675c0c43cd9d3e8ecfa8cf92971ca44f81ca0 Mon Sep 17 00:00:00 2001 From: Bryan Guillaume Date: Tue, 7 Apr 2020 18:16:04 +0200 Subject: [PATCH] Avoid chaining calls to 'subasgn' when writing by indices GIfTI files 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. --- swe_data_write.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swe_data_write.m b/swe_data_write.m index e5dd258..5559c47 100644 --- a/swe_data_write.m +++ b/swe_data_write.m @@ -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