I am running a matlab script on an hpc which save various variables using the following command:
fname = char(['~/Documents/MATLAB/PROCESSING/', strtrim(participant), '/', strtrim(participant),strtrim(task), 'PRO.mat']);
However, I get the following error in that it can't find the folder as long spaces are added to the variable 'participant'.
Error using save
Cannot create ' HC_s02
resting PRO.mat
' because '/home/eb857/Documents/MATLAB/PROCESSING/HC_s02
' does not exist.
Error in LUMO_finalPipeline (line 163)
save(fname, 'dat', '-v7.3');
I have tried doing the following:
participant = strrep(participant, ' ', '');
task = strrep(task, ' ', '');
But I still get the error. Can anyone help me? Thanks!