From c35532942edcca31794aa3f4d1458f574e0c4ef9 Mon Sep 17 00:00:00 2001 From: "dadi.zhao" Date: Mon, 5 Aug 2024 10:23:50 +0100 Subject: [PATCH 1/4] remove varargout --- src/pspm_data_editor.m | 10 ++++------ src/pspm_display.m | 4 ++-- src/pspm_ecg_editor.m | 4 ++-- src/pspm_filtfilt.m | 16 +--------------- src/pspm_find_channel.m | 16 +--------------- src/pspm_jobman.m | 10 +++++----- src/pspm_load1.m | 14 +------------- src/pspm_overwrite.m | 19 +------------------ src/pspm_prepdata.m | 24 +----------------------- src/pspm_pulse_convert.m | 19 ++++--------------- src/pspm_pupil_pp.m | 2 +- src/pspm_rev_con.m | 18 ++---------------- src/pspm_rev_glm.m | 16 +--------------- src/pspm_tam.m | 7 ------- src/pspm_ui.m | 9 +-------- 15 files changed, 27 insertions(+), 161 deletions(-) diff --git a/src/pspm_data_editor.m b/src/pspm_data_editor.m index 691335593..d9c88fb3c 100644 --- a/src/pspm_data_editor.m +++ b/src/pspm_data_editor.m @@ -1,15 +1,14 @@ -function varargout = pspm_data_editor(varargin) +function [sts, out] = pspm_data_editor(varargin) % ● Description % pspm_data_editor MATLAB code for pspm_data_editor.fig % ● Format -% [varargout] = pspm_data_editor(varargin) % [sts, out] = pspm_data_editor(indata, options) % ● Arguments % * indata: Can be multiple kinds of data types. In order to use % pspm_data_editor() to edit acquisition data, the actual % data vector has to be passed via the varargin % argmument. The data should be 1xn or nx1 double vector. -% ┌─────options +% ┌─────options % ├.output_file: Use output_file to specify a file the changed data % │ is saved to when clicking 'save' or 'apply'. Only % │ works in 'file' mode. @@ -46,7 +45,7 @@ end if nargout - [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); + [sts, out] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end @@ -357,7 +356,7 @@ function RemovePlot(hObject, chan_id) end guidata(hObject, handles); -function varargout = pspm_data_editor_OutputFcn(hObject, ~, handles) +function handles.output = pspm_data_editor_OutputFcn(hObject, ~, handles) % Comments % It used to be function varargout = pspm_data_editor_OutputFcn(hObject, ~, handles) % Where the varargout seems not modified? @@ -371,7 +370,6 @@ function RemovePlot(hObject, chan_id) % handles structure with handles and user data (see GUIDATA) % UIWAIT makes pspm_data_editor wait for user response (see UIRESUME) % handles.lbEpochsvarargout{1} = handles.output; -varargout{1} = handles.output; delete(hObject); function lbEpochs_Callback(hObject, ~, ~) diff --git a/src/pspm_display.m b/src/pspm_display.m index 94b2473ed..cdfc938b9 100644 --- a/src/pspm_display.m +++ b/src/pspm_display.m @@ -157,14 +157,14 @@ function pspm_display_OpeningFcn(hObject, ~, handles, varargin) % --- Outputs from this function are returned to the command line. -function varargout = pspm_display_OutputFcn(~, ~, handles) +function handles.output = pspm_display_OutputFcn(~, ~, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure -varargout{1} = handles.output; + end diff --git a/src/pspm_ecg_editor.m b/src/pspm_ecg_editor.m index 4e96a11f8..e41ca327c 100644 --- a/src/pspm_ecg_editor.m +++ b/src/pspm_ecg_editor.m @@ -1,4 +1,4 @@ -function varargout = pspm_ecg_editor(varargin) +function [sts, R] = pspm_ecg_editor(varargin) % ● Description % pspm_ecg_edtior allows manual correction of ecg data and creates a hb % output. Function can be called seperately. @@ -50,7 +50,7 @@ end if nargout - [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); + [sts, R] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end diff --git a/src/pspm_filtfilt.m b/src/pspm_filtfilt.m index cd5d521f3..a37bc98c5 100644 --- a/src/pspm_filtfilt.m +++ b/src/pspm_filtfilt.m @@ -1,4 +1,4 @@ -function varargout = pspm_filtfilt(b,a,x) +function [sts, y] = pspm_filtfilt(b,a,x) % ● Description % pspm_filtfilt. Zero-phase forward and reverse digital filtering % ● Format @@ -39,13 +39,6 @@ end sts = -1; y = []; -switch nargout - case 1 - varargout{1} = y; - case 2 - varargout{1} = sts; - varargout{2} = y; -end %% Check input data if nargin < 3 warning('ID:invalid_input','Not enough parameters were specified.'); return; @@ -97,11 +90,4 @@ if m == 1, y = y.'; end %% Sort outputs sts = 1; -switch nargout - case 1 - varargout{1} = y; - case 2 - varargout{1} = sts; - varargout{2} = y; -end return diff --git a/src/pspm_find_channel.m b/src/pspm_find_channel.m index c56a363fd..b7c540674 100644 --- a/src/pspm_find_channel.m +++ b/src/pspm_find_channel.m @@ -1,4 +1,4 @@ -function varargout = pspm_find_channel(headercell, channeltype) +function [sts, channel] = pspm_find_channel(headercell, channeltype) % ● Description % pspm_find_channel searches a cell arrays of channel headers and % finds the channel that matches the desired type. @@ -26,13 +26,6 @@ end sts = -1; channel = []; -switch nargout - case 1 - varargout{1} = channel; - case 2 - varargout{1} = sts; - varargout{2} = channel; -end %% 1 check input if nargin < 2 warning('ID:invalid_input', '\Not enough input arguments.\n'); @@ -78,11 +71,4 @@ end %% 4 Sort output sts = 1; -switch nargout - case 1 - varargout{1} = channel; - case 2 - varargout{1} = sts; - varargout{2} = channel; -end return diff --git a/src/pspm_jobman.m b/src/pspm_jobman.m index 29c8527df..57c01f768 100644 --- a/src/pspm_jobman.m +++ b/src/pspm_jobman.m @@ -1,4 +1,4 @@ -function varargout = pspm_jobman(varargin) +function job_id = pspm_jobman(varargin) % ● Description % Main interface for PsPM Batch System % Initialise jobs configuration and set MATLAB path accordingly. @@ -53,7 +53,7 @@ if ~nargin h = cfg_ui; - if nargout > 0, varargout = {h}; end + if nargout > 0, job_id = {h}; end return; end @@ -113,19 +113,19 @@ end cfg_ui('local_showjob', findobj(0,'tag','cfg_ui'), cjob); if nargout > 0 - varargout{1} = cjob; + job_id = cjob; end case {'run'} cjob = cfg_util('initjob', mljob); cfg_util('run', cjob); if nargout > 0 - varargout{1} = cfg_util('getalloutputs', cjob); + job_id = cfg_util('getalloutputs', cjob); end cfg_util('deljob', cjob); otherwise - error([varargin{1} ': unknown option']); + error([job_id ': unknown option']); end sts = 1; return diff --git a/src/pspm_load1.m b/src/pspm_load1.m index 6e4f41591..0eceb4af3 100644 --- a/src/pspm_load1.m +++ b/src/pspm_load1.m @@ -1,4 +1,4 @@ -function varargout = pspm_load1(fn, action, savedata, options) +function [sts, data, mdltype] = pspm_load1(fn, action, savedata, options) % ● Format % [sts, data, mdltype] = pspm_load1(fn, action, savedata, options) % ● Arguments @@ -310,17 +310,5 @@ otherwise warning('ID:unknown_action', 'Unknown action. Just checking file. File is valid.'); return; end - sts = 1; -switch nargout - case 1 - varargout{1} = data; - case 2 - varargout{1} = data; - varargout{2} = mdltype; - case 3 - varargout{1} = sts; - varargout{2} = data; - varargout{3} = mdltype; -end return diff --git a/src/pspm_overwrite.m b/src/pspm_overwrite.m index 04ab72579..9a5aba080 100644 --- a/src/pspm_overwrite.m +++ b/src/pspm_overwrite.m @@ -1,4 +1,4 @@ -function varargout = pspm_overwrite(varargin) +function [sts, overwrite_final] = pspm_overwrite(varargin) % ● Description % pspm_overwrite generalises the overwriting operation % pspm_overwrite considers the following situations @@ -35,13 +35,6 @@ end sts = -1; overwrite_final = 0; -switch nargout - case 1 - varargout{1} = overwrite_final; - case 2 - varargout{1} = sts; - varargout{2} = overwrite_final; -end %% 2 Check inputs switch numel(varargin) case 0 @@ -106,14 +99,4 @@ warning('ID:invalid_input', 'overwrite can be only 0 or 1'); return end -%% 5 Check outputs -switch nargout - case 1 - varargout{1} = overwrite_final; - case 2 - varargout{1} = sts; - varargout{2} = overwrite_final; - otherwise - varargout{1} = overwrite_final; -end return diff --git a/src/pspm_prepdata.m b/src/pspm_prepdata.m index 79e3c21a5..41ec1e7b4 100644 --- a/src/pspm_prepdata.m +++ b/src/pspm_prepdata.m @@ -1,4 +1,4 @@ -function varargout = pspm_prepdata(varargin) +function [sts, data, newsr] = pspm_prepdata(varargin) % ● Description % pspm_prepdata is a shared PsPM function for twofold butterworth filting and % downsampling raw data `on the fly`. This data is usually stored in results @@ -47,17 +47,6 @@ end outdata = data; newsr = 0; -switch nargout - case 1 - varargout{1} = outdata; - case 2 - varargout{1} = sts; - varargout{2} = outdata; - case 3 - varargout{1} = sts; - varargout{2} = outdata; - varargout{3} = newsr; -end %% Check input options = pspm_options(options, 'prepdata'); @@ -197,15 +186,4 @@ %% Prepare the final data outdata = data; sts = 1; -switch nargout - case 1 - varargout{1} = outdata; - case 2 - varargout{1} = sts; - varargout{2} = outdata; - case 3 - varargout{1} = sts; - varargout{2} = outdata; - varargout{3} = newsr; -end return diff --git a/src/pspm_pulse_convert.m b/src/pspm_pulse_convert.m index f1ed89b8b..223bdd639 100644 --- a/src/pspm_pulse_convert.m +++ b/src/pspm_pulse_convert.m @@ -1,4 +1,4 @@ -function varargout = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) +function [sts, wavedata] = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) % ● Description % pspm_pulse_convert converts pulsed data into a data waveform, assuming % milliseconds as time unit and a resamplingrate in Hz given as input argument @@ -16,6 +16,9 @@ % * pulsedata : timestamps in ms % * resamplingrate : for interpolation % * samplingrate : to be downsampled to +% ● Outputs +% * sts : status of function processing +% * wavedata : the waveform data that is converted from pulsed data % ● History % Introduced In PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) @@ -28,13 +31,6 @@ end sts = -1; wavedata = []; -switch nargout - case 1 - varargout{1} = wavedata; - case 2 - varargout{1} = sts; - varargout{2} = wavedata; -end % check input arguments if nargin<1 @@ -90,11 +86,4 @@ end end sts = 1; -switch nargout - case 1 - varargout{1} = wavedata; - case 2 - varargout{1} = sts; - varargout{2} = wavedata; -end return diff --git a/src/pspm_pupil_pp.m b/src/pspm_pupil_pp.m index 7364e3ef6..bf16881ba 100644 --- a/src/pspm_pupil_pp.m +++ b/src/pspm_pupil_pp.m @@ -222,7 +222,7 @@ return -function varargout = pspm_preprocess_pupil(data, data_combine, segments, custom_settings, plot_data) +function [sts, smooth_signal, model] = pspm_preprocess_pupil(data, data_combine, segments, custom_settings, plot_data) global settings if isempty(settings) pspm_init; diff --git a/src/pspm_rev_con.m b/src/pspm_rev_con.m index d0801e658..e7dbdde34 100644 --- a/src/pspm_rev_con.m +++ b/src/pspm_rev_con.m @@ -1,8 +1,8 @@ -function varargout = pspm_rev_con(model) +function [sts, fighandle] = pspm_rev_con(model) % ● Description % pspm_rev_con is a tool for reviewing contrasts of first level models % ● Format -% fighandle = pspm_rev_con(modelfile) +% [sts, fighandle] = pspm_rev_con(modelfile) % ● Arguments % * modelfile: filename and path of modelfile % ● History @@ -16,13 +16,6 @@ end sts = -1; fighandle = []; -switch nargout - case 1 - varargout{1} = fighandle; - case 2 - varargout{1} = sts; - varargout{2} = fighandle; -end % check input % ------------------------------------------------------------------------ @@ -41,11 +34,4 @@ fprintf('---------------------------------------\n'); sts = 1; -switch nargout - case 1 - varargout{1} = fighandle; - case 2 - varargout{1} = sts; - varargout{2} = fighandle; -end return diff --git a/src/pspm_rev_glm.m b/src/pspm_rev_glm.m index 3fba8ec35..8a448ed2e 100644 --- a/src/pspm_rev_glm.m +++ b/src/pspm_rev_glm.m @@ -1,4 +1,4 @@ -function varargout = pspm_rev_glm(modelfile, plotNr) +function [sts, fig] = pspm_rev_glm(modelfile, plotNr) % ● Description % pspm_rev_glm is a tool for reviewing a first level GLM designs. It is % meant to be called by pspm_review only. @@ -28,13 +28,6 @@ end sts = -1; fig = struct(); -switch nargout - case 1 - varargout{1} = fig; - case 2 - varargout{1} = sts; - varargout{2} = fig; -end % check input % ------------------------------------------------------------------------ @@ -238,11 +231,4 @@ end end sts = 1; -switch nargout - case 1 - varargout{1} = fig; - case 2 - varargout{1} = sts; - varargout{2} = fig; -end return diff --git a/src/pspm_tam.m b/src/pspm_tam.m index 60c0e5751..e23350862 100644 --- a/src/pspm_tam.m +++ b/src/pspm_tam.m @@ -403,11 +403,4 @@ %% User output fprintf('done. \n'); sts = 1; -switch nargout - case 1 - varargout{1} = tam; - case 2 - varargout{1} = sts; - varargout{2} = tam; -end return diff --git a/src/pspm_ui.m b/src/pspm_ui.m index 564f47333..bf16a1d35 100644 --- a/src/pspm_ui.m +++ b/src/pspm_ui.m @@ -1,4 +1,4 @@ -function varargout = pspm_ui(hObject,handles,window) +function [hObject, handles] = pspm_ui(hObject,handles,window) % ● Description % pspm_ui controls the UI of the referred handle. % ● Arguments @@ -310,13 +310,6 @@ if exist('EmphComponents', 'var') ApplyStyle(handles, EmphComponents, FNEmph, FSText); end -switch nargout - case 1 - varargout{1} = hObject; - case 2 - varargout{1} = hObject; - varargout{2} = handles; -end return function ApplyStyle(handles, widgt, FN, FS) [r,c] = size(widgt); From a3a969aa53f1af61c747aeb3025b315ad84d7f5c Mon Sep 17 00:00:00 2001 From: "dadi.zhao" Date: Mon, 5 Aug 2024 10:48:19 +0100 Subject: [PATCH 2/4] update for previously fixed functions --- doc/PsPM_Developers_Guide.lyx | 2 +- src/pspm_extract_segments.m | 2 +- src/pspm_find_channel.m | 5 +---- src/pspm_get_smrx.m | 2 +- src/pspm_overwrite.m | 4 ++-- src/pspm_prepdata.m | 4 ++-- src/pspm_pulse_convert.m | 4 ++-- src/pspm_rev_dcm.m | 2 +- src/pspm_rev_glm.m | 2 +- src/pspm_review.m | 15 ++++++++------- 10 files changed, 20 insertions(+), 22 deletions(-) diff --git a/doc/PsPM_Developers_Guide.lyx b/doc/PsPM_Developers_Guide.lyx index 0f0f04938..74a00bd4c 100644 --- a/doc/PsPM_Developers_Guide.lyx +++ b/doc/PsPM_Developers_Guide.lyx @@ -24091,7 +24091,7 @@ Function \begin_layout Standard \family typewriter -wavedata = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) +[sts, wavedata] = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) \end_layout \begin_layout Subsubsection diff --git a/src/pspm_extract_segments.m b/src/pspm_extract_segments.m index aa89daec0..cf72e38db 100644 --- a/src/pspm_extract_segments.m +++ b/src/pspm_extract_segments.m @@ -75,7 +75,7 @@ (~strcmpi(method, 'model') && nargin < 4) warning('ID:invalid_input', 'Don''t know what to do'); return elseif strcmpi(method, 'model') - data = pspm_load1(data, 'all'); + [~, data, ~] = pspm_load1(data, 'all'); if nargin > 2 options = varargin{1}; end diff --git a/src/pspm_find_channel.m b/src/pspm_find_channel.m index b7c540674..1727223cc 100644 --- a/src/pspm_find_channel.m +++ b/src/pspm_find_channel.m @@ -1,9 +1,8 @@ -function [sts, channel] = pspm_find_channel(headercell, channeltype) +function channel = pspm_find_channel(headercell, channeltype) % ● Description % pspm_find_channel searches a cell arrays of channel headers and % finds the channel that matches the desired type. % ● Format -% [sts, channel] = pspm_find_channel(headercell, channeltype) or % channel = pspm_find_channel(headercell, channeltype) % ● Arguments % * headercell: cell array of names (e.g. from acq import) @@ -69,6 +68,4 @@ else channel = find(channelflag==1); end -%% 4 Sort output -sts = 1; return diff --git a/src/pspm_get_smrx.m b/src/pspm_get_smrx.m index 0246c65e0..6c0ab84c9 100644 --- a/src/pspm_get_smrx.m +++ b/src/pspm_get_smrx.m @@ -100,7 +100,7 @@ if import{iImport}.channel > 0 channel = chanindx(import{iImport}.channel); else - [sts, channel] = pspm_find_channel({fileinfo.chaninfo.kind},... + channel = pspm_find_channel({fileinfo.chaninfo.kind},... import{iImport}.type); if sts < 1, return; end end diff --git a/src/pspm_overwrite.m b/src/pspm_overwrite.m index 9a5aba080..6263198a7 100644 --- a/src/pspm_overwrite.m +++ b/src/pspm_overwrite.m @@ -1,4 +1,4 @@ -function [sts, overwrite_final] = pspm_overwrite(varargin) +function overwrite_final = pspm_overwrite(varargin) % ● Description % pspm_overwrite generalises the overwriting operation % pspm_overwrite considers the following situations @@ -18,7 +18,7 @@ % If a value, can be 0 (not to overwrite) or 1 (to overwrite). % If a struct, check if the field `overwrite` exist. % ● Examples -% [sts, overwrite_final] = pspm_overwrite(fn, overwrite) +% overwrite_final = pspm_overwrite(fn, overwrite) % ● Outputs % * overwrite_final: option of overwriting determined by pspm_overwrite % 0: not to overwrite diff --git a/src/pspm_prepdata.m b/src/pspm_prepdata.m index 41ec1e7b4..72b9a7a31 100644 --- a/src/pspm_prepdata.m +++ b/src/pspm_prepdata.m @@ -117,7 +117,7 @@ data = filter(filt.b, filt.a, data); data = filter(filt.b, filt.a, data); else - data = pspm_filtfilt(filt.b, filt.a, data); + [~, data] = pspm_filtfilt(filt.b, filt.a, data); end end end @@ -132,7 +132,7 @@ data = filter(filt.b, filt.a, data); data = filter(filt.b, filt.a, data); else - data = pspm_filtfilt(filt.b, filt.a, data); + [~, data] = pspm_filtfilt(filt.b, filt.a, data); end end % if uni, remove dummy data diff --git a/src/pspm_pulse_convert.m b/src/pspm_pulse_convert.m index 223bdd639..35f5b5b1a 100644 --- a/src/pspm_pulse_convert.m +++ b/src/pspm_pulse_convert.m @@ -11,7 +11,7 @@ % resolution of the 1401 and more likely to be a technical glitch. These % time stamps are filtered out before re-sampling. % ● Format -% wavedata = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) +% [sts, wavedata] = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) % ● Arguments % * pulsedata : timestamps in ms % * resamplingrate : for interpolation @@ -78,7 +78,7 @@ filt.direction = 'bi'; filt.down = samplingrate; filt.sr = resamplingrate; - [sts_prepdata, wavedata] = pspm_prepdata(wavedata, filt); + [sts_prepdata, wavedata, ~] = pspm_prepdata(wavedata, filt); if sts_prepdata ~= 1 warning('ID:invalid_input', 'call of pspm_prepdata failed'); return diff --git a/src/pspm_rev_dcm.m b/src/pspm_rev_dcm.m index e7037d93d..59cc19ec1 100644 --- a/src/pspm_rev_dcm.m +++ b/src/pspm_rev_dcm.m @@ -36,7 +36,7 @@ try, sn; catch, sn = 1; end; if ischar(dcm) - dcm = pspm_load1(dcm, 'all'); + [~, dcm, ~] = pspm_load1(dcm, 'all'); end % check input diff --git a/src/pspm_rev_glm.m b/src/pspm_rev_glm.m index 8a448ed2e..73f508a09 100644 --- a/src/pspm_rev_glm.m +++ b/src/pspm_rev_glm.m @@ -3,7 +3,7 @@ % pspm_rev_glm is a tool for reviewing a first level GLM designs. It is % meant to be called by pspm_review only. % ● Format -% fig = pspm_rev_glm(modelfile, plotNr) +% [sts, fig] = pspm_rev_glm(modelfile, plotNr) % ● Arguments % * modelfile : filename and path of modelfile % * plotNr : defines which figure shall be plotted diff --git a/src/pspm_review.m b/src/pspm_review.m index ad5d3a8ca..8772eb2f4 100644 --- a/src/pspm_review.m +++ b/src/pspm_review.m @@ -193,7 +193,7 @@ function buttonPlot1_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_glm(handles.modelData{handles.currentModel}.modelfile, 1); case 'dcm' @@ -226,7 +226,7 @@ function buttonPlot2_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_glm(handles.modelData{handles.currentModel}.modelfile, 2); case 'dcm' @@ -254,7 +254,7 @@ function buttonPlot3_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_glm(handles.modelData{handles.currentModel}.modelfile, 3); case 'dcm' @@ -276,7 +276,7 @@ function buttonPlot4_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_glm(handles.modelData{handles.currentModel}.modelfile, 4); case 'dcm' pspm_rev_dcm(handles.modelData{handles.currentModel}.model, 'names'); @@ -293,10 +293,10 @@ function buttonPlot5_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_glm(handles.modelData{handles.currentModel}.modelfile, 5); case 'dcm' - handles.modelData{handles.currentModel}.fig = ... + [~, handles.modelData{handles.currentModel}.fig] = ... pspm_rev_con(handles.modelData{handles.currentModel}.model); end @@ -312,7 +312,8 @@ function buttonPlot6_Callback(hObject, ~, handles) set(handles.textStatus,'String','Plotting is in progress. Please wait...'); switch handles.modelData{handles.currentModel}.modeltype case 'glm' - handles.modelData{handles.currentModel}.fig = pspm_rev_con(handles.modelData{handles.currentModel}.model); + [~, handles.modelData{handles.currentModel}.fig] = ... + pspm_rev_con(handles.modelData{handles.currentModel}.model); end set(handles.textStatus,'String',tmpStatusString); From 8a856d15b71312abe2e6ac79a9a7c9e2ed052c14 Mon Sep 17 00:00:00 2001 From: "dadi.zhao" Date: Wed, 7 Aug 2024 01:06:31 +0100 Subject: [PATCH 3/4] minor fixes --- src/pspm_data_editor.m | 5 +---- src/pspm_pupil_pp.m | 8 -------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/pspm_data_editor.m b/src/pspm_data_editor.m index d9c88fb3c..75c741088 100644 --- a/src/pspm_data_editor.m +++ b/src/pspm_data_editor.m @@ -356,10 +356,7 @@ function RemovePlot(hObject, chan_id) end guidata(hObject, handles); -function handles.output = pspm_data_editor_OutputFcn(hObject, ~, handles) -% Comments -% It used to be function varargout = pspm_data_editor_OutputFcn(hObject, ~, handles) -% Where the varargout seems not modified? +function varargout = pspm_data_editor_OutputFcn(hObject, ~, handles) % Feature % Outputs from this function are returned to the command line. % Varargout diff --git a/src/pspm_pupil_pp.m b/src/pspm_pupil_pp.m index bf16881ba..0ed5e8cbf 100644 --- a/src/pspm_pupil_pp.m +++ b/src/pspm_pupil_pp.m @@ -319,14 +319,6 @@ end rmpath(libpath{:}); sts = 1; -varargout{1} = sts; -switch nargout - case 2 - varargout{2} = smooth_signal; - case 3 - varargout{2} = smooth_signal; - varargout{3} = model; -end function data = pspm_complete_with_nans(data, t_beg, sr, output_samples) % Complete the given data that possibly has missing samples at the % beginning and at the end. The amount of missing samples is determined From db178fa35c2f95bfd9bd600fb59bb84d66fc6b9f Mon Sep 17 00:00:00 2001 From: "dadi.zhao" Date: Wed, 7 Aug 2024 01:15:15 +0100 Subject: [PATCH 4/4] minor corrections --- src/pspm_filtfilt.m | 2 +- src/pspm_get_smr.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pspm_filtfilt.m b/src/pspm_filtfilt.m index a37bc98c5..0c8964621 100644 --- a/src/pspm_filtfilt.m +++ b/src/pspm_filtfilt.m @@ -47,7 +47,7 @@ if n>1 && m>1 y = zeros(size(x)); for i=1:n - y(:,i) = pspm_filtfilt(b,a,x(:,i)); + [~, y(:,i)] = pspm_filtfilt(b,a,x(:,i)); end return end diff --git a/src/pspm_get_smr.m b/src/pspm_get_smr.m index cdefe56aa..c7927647c 100644 --- a/src/pspm_get_smr.m +++ b/src/pspm_get_smr.m @@ -76,7 +76,7 @@ % get minimum frequency for reporting resolution import{iImport}.minfreq = min(1./diff(chandata{channel}))*1000; % convert pulse to waveform - import{iImport}.data = pspm_pulse_convert(chandata{channel}, settings.import.rsr, settings.import.sr); + [~, import{iImport}.data] = pspm_pulse_convert(chandata{channel}, settings.import.rsr, settings.import.sr); import{iImport}.sr = settings.import.sr; import{iImport}.minfreq = min(import{iImport}.data); elseif chanhead{channel}.kind == 4 % up and down timestamps @@ -86,7 +86,7 @@ pulse(1)=[]; end pulse = pulse(1:2:end); - import{iImport}.data = pspm_pulse_convert(pulse, settings.import.rsr, settings.import.sr); + [~, import{iImport}.data] = pspm_pulse_convert(pulse, settings.import.rsr, settings.import.sr); import{iImport}.sr = settings.import.sr; import{iImport}.minfreq = min(import{iImport}.data); else