help > Error using mat2file
Showing 1-2 of 2 posts
Display:
Results per page:
Aug 25, 2025  12:08 PM | mawojcik
Error using mat2file

Hello,


I have a repeating problem with denoising step in CONN. I work on a dataset of 122 subjects from the task-based fMRI session. Mostly, I have ran their preprocessing outside of the CONN, but after importing their data, I ran functional outlier detection (ART). It went well. (Also, on the sidenote: I worked on similar dataset previously on this exact same computer in this exact same way and had no problems with preprocessing/denoising/1st lvl analyses whatsoever.)


However, when running denoising, I keep getting error with mat2file. At first I thought it was a space issue, but after clearing disc space nothing has changed. Reinstallation of SPM wasn't successfull either. Finally, when I tried to run denoising in smaller parts (I thought it might be an issue with my computer's operation memory) like 10 subjects at once it worked well but after around 40 subjects (4x10) it began to crash similarly. Now even 1 subject results in this error. I'm helpless. Please, if you have any solution, I would be very grateful!


I work on matlab 2018b and SPM25 (as I downloaled the newest version due to the suggestions found on this forum; but before it was SPM12 which wasn't a better fit). 


Here is the full error message that's haunting me for weeks now...:


 


Error using mat2file


Problem writing last piece of data (could be a disk space or quota issue).


Error in file_array/subsasgn>subfun (line 162)


mat2file(sobj,dat,va{:});


Error in file_array/subsasgn (line 83)


subfun(sobj,double(dat),args{:});


Error in spm_write_plane (line 30)


V.private.dat = subsasgn(V.private.dat,S,dat);


Error in conn_process (line 1454)


Voutputfiles{nses}(nt)=spm_write_plane(Voutputfiles{nses}(nt),t,slice);


Error in conn_process (line 69)


case {'preprocessing_gui','denoising_gui'}, conn_disp(['CONN: RUNNING DENOISING STEP']); conn_process([1.5,2,6:9],varargin{:});


Error in conn (line 7225)


conn_process('denoising_gui'); ispending=false;


Error in conn_menumanager (line 125)


feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});


CONN22.v2407


SPM25 + DAiSS DEM FieldMap MEEGtools


Matlab v.2018b


project: CONN22.v2407


storage: 3910.3Gb available

Aug 28, 2025  10:08 PM | Alfonso Nieto-Castanon - Boston University
RE: Error using mat2file

Hi 


You are right that from your description this definitely looks like a "storage-full" problem. The files that CONN is trying to write when this error occurrs are not stored in your CONN project folder (which seems to have more than enough space) but in the same folder/directory as your original functional data (which may be in the same or in a different hard drive or storage location from your CONN project). Can you double-check if that location also has sufficient storage space (and permissions) for creating new files there?


Hope this helps


Alfonso


Originally posted by mawojcik:



Hello,


I have a repeating problem with denoising step in CONN. I work on a dataset of 122 subjects from the task-based fMRI session. Mostly, I have ran their preprocessing outside of the CONN, but after importing their data, I ran functional outlier detection (ART). It went well. (Also, on the sidenote: I worked on similar dataset previously on this exact same computer in this exact same way and had no problems with preprocessing/denoising/1st lvl analyses whatsoever.)


However, when running denoising, I keep getting error with mat2file. At first I thought it was a space issue, but after clearing disc space nothing has changed. Reinstallation of SPM wasn't successfull either. Finally, when I tried to run denoising in smaller parts (I thought it might be an issue with my computer's operation memory) like 10 subjects at once it worked well but after around 40 subjects (4x10) it began to crash similarly. Now even 1 subject results in this error. I'm helpless. Please, if you have any solution, I would be very grateful!


I work on matlab 2018b and SPM25 (as I downloaled the newest version due to the suggestions found on this forum; but before it was SPM12 which wasn't a better fit). 


Here is the full error message that's haunting me for weeks now...:


 


Error using mat2file


Problem writing last piece of data (could be a disk space or quota issue).


Error in file_array/subsasgn>subfun (line 162)


mat2file(sobj,dat,va{:});


Error in file_array/subsasgn (line 83)


subfun(sobj,double(dat),args{:});


Error in spm_write_plane (line 30)


V.private.dat = subsasgn(V.private.dat,S,dat);


Error in conn_process (line 1454)


Voutputfiles{nses}(nt)=spm_write_plane(Voutputfiles{nses}(nt),t,slice);


Error in conn_process (line 69)


case {'preprocessing_gui','denoising_gui'}, conn_disp(['CONN: RUNNING DENOISING STEP']); conn_process([1.5,2,6:9],varargin{:});


Error in conn (line 7225)


conn_process('denoising_gui'); ispending=false;


Error in conn_menumanager (line 125)


feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});


CONN22.v2407


SPM25 + DAiSS DEM FieldMap MEEGtools


Matlab v.2018b


project: CONN22.v2407


storage: 3910.3Gb available