SAND-Lab / MEA-NAP

MEA-NAP. A streamlined diagnostic and analytic tool for data obtained using microelectrode arrays.
GNU General Public License v3.0
12 stars 6 forks source link

save figures in plotSpikeDetectionChecks #17

Closed yuanyin98 closed 1 year ago

yuanyin98 commented 2 years ago

Links for variables in debug mode: https://www.dropbox.com/s/p3usfpxivmjls56/matlabWorkspace_%20plotSpikeDetectionChecks20220815.mat?dl=0 https://www.dropbox.com/s/s48fkqw02c531t3/matlabWorkspace_%20pipelineSaveFig20220815.mat?dl=0

Output folder link: https://www.dropbox.com/sh/csiowbzwewkdv2o/AABaRzlKBCDbuqN3OGDNCszQa?dl=0

Actual error message: Error using save Error closing file C:\Users\Sand Box\Dropbox (Cambridge University)\Sand Box PC MATLAB\MATLAB\MEAGit202208\OutputData15Aug2022\1_SpikeDetection\1B_SpikeDetectionChecks\PostStim\220725_Mutant_ALICO1_6_poststim\ExampleTraces.fig. The file may be corrupt.

Error in matlab.graphics.internal.figfile.FigFile/write (line 32) save(obj.Path, obj.MatVersion, '-struct', 'SaveVars');

Error in savefig (line 83) FF.write();

Error in saveasfig (line 6) savefig(h, name);

Error in saveas (line 153) feval( ['saveas' format], h, name )

Error in pipelineSaveFig (line 54) saveas(gcf, figFileName);

Error in plotSpikeDetectionChecks (line 216) pipelineSaveFig(figName, Params.figExt, Params.fullSVG)

Timothysit commented 2 years ago

Hi Yin,

Seems like this may be due to plotSpikeDetectionChecks.m closing Params.oneFigure, as the way this code deals with switching between "popping out" individual figures (when Params.showOneFig = False) and always plotting on the same figure (Params.oneFigure) is not in line with other functions, such as plotNetMetNodeCartography.m, I have fixed that now, let me know if it works / if you still see errors.

The change is in commit https://github.com/SAND-Lab/AnalysisPipeline/commit/a8ba67e3d701ec573deb57bf5c7ada33d1aba62a

Timothysit commented 1 year ago

Closing this issue because Params.oneFigure is no longer used in the latest version (v1.4.0) of the pipeline. The pipeline now uses the variable OneFigureHandle to handle this.