fNIRS / snirf_homer3

Repository for SNIRF reader/writer applications
6 stars 2 forks source link

Failed to run demo_snirf.m on Windows 11 #8

Open snowuyl opened 1 year ago

snowuyl commented 1 year ago

setpaths demo_snirf

Converting D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.nirs to D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.snirf Saving D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.snirf ... Unrecognized function or variable 'ispathvalid'.

Error in StimClass/SaveHdf5 (line 156) if ~ispathvalid(fileobj, 'file')

Error in SnirfClass/SaveStim (line 600) obj.stim(ii).SaveHdf5(fileobj, [obj.location, '/stim', num2str(ii)]);

Error in SnirfClass/SaveHdf5 (line 654) obj.SaveStim(fileobj);

Error in SnirfClass/Save (line 667) obj.SaveHdf5(fileobj);

Error in snirf_load_save (line 39) tic; snirf_saved.Save(outfile); toc

Error in demo_snirf (line 29) [snirf_saved, snirf_loaded] = snirf_load_save([pname, '/', nirsfiles(ii).name]);

demo_snirf

Converting D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.nirs to D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.snirf Saving D:/workspace_MATLAB/snirf_homer3/Snirf/Examples/Simple_Probe.snirf ... Unrecognized function or variable 'ispathvalid'.

Error in StimClass/SaveHdf5 (line 156)

BAK262 commented 8 months ago

I met the same issue on MacBook Air (M1 version), macOS=Sonoma 14.1.1, matlab R2023a.

My solution is to modify the line 156 in StimClass.m as: if ~isfile(fileobj)

It worked well, except for the error: ERROR: Saved and loaded SnirfClass objects for video.snirf are NOT equal but I think this is another independent issue.