EEG data pre-processing script. Everything works fine until i get this: "Error using floatwrite (line 80) Cannot write output file, check permission and space"

I get this error but the rest of the code is working well. It stucks just at the final step, when it is saving the dataset. I'm using EEGlab and these plugins: ERPlab, Biosig, Dipfit, Fileio, Fieldtrip and Firlift.
The full error is:
Error using floatwrite (line 80)
Cannot write output file, check permission and space
Error in floatwrite (line 80)
if fid == -1, error('Cannot write output file, check permission and space'); end;
Error in pop_saveset (line 228)
tmpdata = floatwrite( tmpdata, fullfile(EEG.filepath, EEG.data), 'ieee-le');
I checked the free disk space and it's more than 90 GB so I don't think that's the issue. I also checked if there was any restriction I mistakenly set to the directory I want to save the dataset. I use Mac OS 10.8.5 and MATLAB 2014b. I also tried to set several different directories to check if it was a problem related to a directory the script didn't like for some reason.

6 件のコメント

Rik
Rik 2019 年 3 月 5 日
Just to confirm: you mean this function?
Can you show what fullfile(EEG.filepath, EEG.data) evaluates to?
Put a breakpoint at the fopen near line 79. When it is reached, check to see what the name of the file it is writing is. Then experiment with
[fid, msg] = fopen(NAME_OF_THE_FILE_GOES_HERE)
and see what msg is produced.
Jordan Wylie
Jordan Wylie 2019 年 9 月 17 日
編集済み: Jordan Wylie 2019 年 9 月 17 日
I am also getting this same error. Unable to continue pre-processing because of the floatwrite error. I can confirm that yes it is this function.
Below is the relevant code:
EEG = eeg_checkset( EEG );
filename = [exptname,'_',id,'_epoch.set'];
EEG = pop_saveset( EEG, 'filename', filename, 'filepath', filepathout);
And the errors:
Error using floatwrite (line 81)
Cannot write output file, check permission and space
Error in floatwrite (line 81)
if fid == -1, error('Cannot write output file, check permission and space'); end;
Error in pop_saveset (line 228)
tmpdata = floatwrite( tmpdata, fullfile(EEG.filepath, EEG.data), 'ieee-le');
What message was produced when you used the debugging step I recommended just above?
I have got the same issue - have you been able to solve it?
I got the same error, but now solved. My problem is the save path did not exist, so I used the follow code to solve it.
if ~exist(strcat(SavePath))%new folder to save preprocess data
mkdir(strcat(SavePath))
end

サインインしてコメントする。

回答 (2 件)

Brian Erickson
Brian Erickson 2020 年 11 月 20 日
Long time ago but a note that if you're using
EEG = pop_saveset( EEG, 'filename',[file,'.txt'],'filepath',[path,'myfile.txt'])
or something like it (you have '.set' at the end, be aware that the last argument to pop_saveset is just the PATH not the path + filename. So
EEG = pop_saveset( EEG, 'filename',[file,'.txt'],'filepath',path)
will work. It's just a super dumb unhelpful error message, but the problem is that pop_saveset is trying to write to a path that doesn't exist because the filename is incorrectly appended to it.
xiaofei dong
xiaofei dong 2021 年 9 月 24 日
I got the same error, but now solved. My problem is the save path did not exist, so I used the follow code to solve it.
if ~exist(strcat(SavePath))%new folder to save preprocess data
mkdir(strcat(SavePath))
end

カテゴリ

ヘルプ センター および File ExchangeEEG/MEG/ECoG についてさらに検索

製品

リリース

R2014b

質問済み:

2019 年 3 月 5 日

回答済み:

2021 年 9 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by