From fe608e5d4e0bb2b3fc034359e1248c4df7f9a8bc Mon Sep 17 00:00:00 2001 From: "Lance (Weiqing) Xu" Date: Thu, 12 Feb 2026 11:38:05 +0100 Subject: [PATCH 1/4] Remove git.m as Matlab has built-in Source Control tools since R2019a --- git.m | 151 ---------------------------------------------------------- 1 file changed, 151 deletions(-) delete mode 100644 git.m diff --git a/git.m b/git.m deleted file mode 100644 index 48c739cb..00000000 --- a/git.m +++ /dev/null @@ -1,151 +0,0 @@ -function [cmdout, statout] = git(varargin) -% A thin MATLAB wrapper for Git. -% -% Short instructions: -% Use this exactly as you would use the OS command-line verison of Git. -% -% Long instructions are: -% This is not meant to be a comprehensive guide to the near-omnipotent -% Git SCM: -% http://git-scm.com/documentation -% -% Common MATLAB workflow: -% -% % Creates initial repository tracking all files under some root -% % folder -% >> cd ~/ -% >> git init -% -% % Shows changes made to all files in repo (none so far) -% >> git status -% -% % Create a new file and add some code -% >> edit foo.m -% -% % Check repo status, after new file created -% >> git status -% -% % Stage/unstage files for commit -% >> git add foo.m % Add file to repo or to stage -% >> git reset HEAD . % To unstage your files from current commit area -% -% % Commit your changes to a new branch, with comments -% >> git commit -m 'Created new file, foo.m' -% -% % Other useful commands (replace ellipses with appropriate args) -% >> git checkout ... % To restore files to last commit -% >> git branch ... % To create or move to another branch -% >> git diff ... % See line-by-line changes -% -% Useful resources: -% 1. GitX: A visual interface for Git on the OS X client -% 2. Github.com: Remote hosting for Git repos -% 3. Git on Wikipedia: Further reading -% -% v0.1, 27 October 2010 -- MR: Initial support for OS X & Linux, -% untested on PCs, but expected to work -% -% v0.2, 11 March 2011 -- TH: Support for PCs -% -% v0.3, 12 March 2011 -- MR: Fixed man pages hang bug using redirection -% -% v0.4, 20 November 2013-- TN: Searching for git in default directories, -% returning results as variable -% -% v0.5, 22 January 2015 -- TP: Suppressed printing of ans before -% git command output -% -% v0.6, 26 January 2015 -- HG: Add path to git -% -% v0.7 09 April 2015 -- VF: If user requests it, return Git results -% as a variable instead of displaying them. -% -% v0.8 24 Juli 2015 -- MvdL: Return status output -% -% -% Contributors: (MR) Manu Raghavan -% (TH) Timothy Hansell -% (TN) Tassos Natsakis -% (TP) Tyler Parsons -% (HG) Han Geerligs -% (VF) Vadim Frolov -% (MvdL) Marcel van der Linden -% -orgpath=getenv('PATH'); -quit_function=0; -try - % Test to see if git is installed - [status,~] = system('git --version'); - % if git is in the path this will return a status of 0 - % it will return a 1 only if the command is not found - - % git command output - result = ''; - - if status - % Checking if git exists in the default installation folders (for - % Windows) - if ispc - search = ~isempty(dir('c:\Program Files\Git\bin\git.exe')); - searchx86 = ~isempty(dir('c:\Program Files (x86)\Git\bin\git.exe')); - else - search = 0; - searchx86 = 0; - end - - if ~(search||searchx86) - % If git is NOT installed, then this should end the function. - result = sprintf('git is not installed\n%s\n',... - 'Download it at http://git-scm.com/download'); - quit_function=1; % set quit_function flag: only result is displayed - end - end - - % if quit_function then only display message - if ~quit_function - % If git exists but the status is 1, then it means that it is - % not in the path. We should add the path - if status - if search - gitpath='c:\Program Files\Git\bin'; - else if searchx86 - gitpath='c:\Program Files (x86)\Git\bin'; - end - end - setenv('PATH',[gitpath pathsep orgpath]); % add path to git - end - - % We can call the real git with the arguments - arguments = parse(varargin{:}); - if ispc - prog = ''; - else - prog = ' | cat'; - end - if strcmp(arguments, 'commit ') - answer = inputdlg('Comments:','Commit''s comments'); - arguments = [arguments '-m"' char(answer) '"']; - end - [status,result] = system(['git ',arguments,prog]); - end - if nargout >= 1 - cmdout = strtrim(result); - statout = status; - else - % Display result instead of returning it - % to suppress output of ans - disp(result); - end - - % restore the original path - setenv(orgpath); -catch - % restore the original path - setenv(orgpath); -end -end - -function space_delimited_list = parse(varargin) -space_delimited_list = cell2mat(... - cellfun(@(s)([s,' ']),varargin,'UniformOutput',false)); -end From e336f97bcf7e9054324d96dc01da61e73bb4904d Mon Sep 17 00:00:00 2001 From: "Lance (Weiqing) Xu" Date: Thu, 12 Feb 2026 13:24:34 +0100 Subject: [PATCH 2/4] Refactor SEEvaluationGui to initialize processors as empty and update module selection logic for better synchronization --- +gui/SEEvaluationGui.m | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/+gui/SEEvaluationGui.m b/+gui/SEEvaluationGui.m index 58253657..9afaf40b 100644 --- a/+gui/SEEvaluationGui.m +++ b/+gui/SEEvaluationGui.m @@ -12,8 +12,8 @@ if nargin>0 obj.handle=varargin{1}; end - obj.processors{1}=interfaces.SEEvaluationProcessor; - obj.currentmodule.number=1; + obj.processors={}; % Initialize as empty, modules are added via addmodule + obj.currentmodule.number=0; % No module selected initially end function pard=guidef(obj) pard=guidef(obj); @@ -56,10 +56,14 @@ function setGuiParameters(obj,p,setchildren,setmenulist) rgp=obj.getPar('ROI_restoreparameters'); if isempty(rgp)|| rgp setGuiParameters@interfaces.SEProcessor(obj,p,setchildren,setmenulist); + + % Clear both table AND processors to ensure synchronization obj.guihandles.modules.Data={}; + obj.processors = {}; % Clear processors array + if isfield(p,'children') modules=fieldnames(p.children); - for k=1:length(modules); + for k=1:length(modules) mh=modules{k}; while mh(end)>'0'&&mh(end)<'9' mh=mh(1:end-1); @@ -79,9 +83,10 @@ function setGuiParameters(obj,p,setchildren,setmenulist) % Yu-Le added end/ end - %set on / off + %set on / off (only for indices within bounds) for k=1:length(modules) - if isfield(p,'modules')&&~isempty(find(strcmpi(p.modules.Data(:,2),modules{k}),1)) + if k <= size(obj.guihandles.modules.Data,1) && ... + isfield(p,'modules')&&~isempty(find(strcmpi(p.modules.Data(:,2),modules{k}),1)) val=p.modules.Data{k,1}; obj.guihandles.modules.Data{k,1}=val; end @@ -226,9 +231,15 @@ function evaluatesite(obj,site,ploton) s=size(d); for k=1:s(1) if d{k,1} %evaluate - module=obj.processors{k}; - module.display=p.se_display; - module.evaluate(site); + % Check if processor exists at this index + if k <= length(obj.processors) + module=obj.processors{k}; + module.display=p.se_display; + module.evaluate(site); + else + warning('SEEvaluationGui:IndexMismatch', ... + 'Module row %d in table exceeds processors array length (%d). Skipping evaluation.', k, length(obj.processors)); + end end end end From bb3f7d0c04ffe0181bda3ed59893a67ea1025281 Mon Sep 17 00:00:00 2001 From: "Lance (Weiqing) Xu" Date: Thu, 12 Feb 2026 17:26:36 +0100 Subject: [PATCH 3/4] Fix condition for excluding fields from save and add validity check for child resize method --- +interfaces/GuiModuleInterface.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/+interfaces/GuiModuleInterface.m b/+interfaces/GuiModuleInterface.m index d2eb40d6..02f82c65 100644 --- a/+interfaces/GuiModuleInterface.m +++ b/+interfaces/GuiModuleInterface.m @@ -304,7 +304,7 @@ function setGuiParameters(obj,p,setchildren,setmenulist) phere=p; h=obj.guihandles; for k=1:length(fn) - if isfield(h,fn{k})&&isprop(h.(fn{k}),'Style')&&~strcmp(h.(fn{k}).Style,'text')&&~any(ismember(obj.excludeFromSave,fn)) + if isfield(h,fn{k})&&isprop(h.(fn{k}),'Style')&&~strcmp(h.(fn{k}).Style,'text')&&~ismember(fn{k}, obj.excludeFromSave) hs=obj.value2handle(phere.(fn{k}),h.(fn{k})); if (strcmp(h.(fn{k}).Style,'popupmenu')) @@ -456,7 +456,11 @@ function resize(obj,factor) if ~isempty(obj.children) ch=fieldnames(obj.children); for k=1:length(ch) - obj.children.(ch{k}).resize(factor); + child = obj.children.(ch{k}); + % Check if child is a valid object with resize method + if isvalid(child) && ismethod(child, 'resize') + child.resize(factor); + end end end end From 6f2772c28761fc164bb43791d7b7ecd667a6bc49 Mon Sep 17 00:00:00 2001 From: "Lance (Weiqing) Xu" Date: Thu, 12 Feb 2026 17:58:40 +0100 Subject: [PATCH 4/4] Proceed only if error message is not empty in `error_reset` function --- +gui/GuiMainSMAP.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/+gui/GuiMainSMAP.m b/+gui/GuiMainSMAP.m index ad2c619e..e0ecebfa 100644 --- a/+gui/GuiMainSMAP.m +++ b/+gui/GuiMainSMAP.m @@ -425,8 +425,12 @@ function error_callback(obj,b) function error_reset(a,b,obj) if a.Value==0 -warndlg(obj.getPar('errorindicator')); -resetstyle(obj) + errmsg=obj.getPar('errorindicator'); + % Only show dialog if error message is not empty + if ~isempty(errmsg) + warndlg(errmsg); + end + resetstyle(obj) end end