Skip to content

Commit

Permalink
Merge pull request #875 from AlbertoCuadra/develop
Browse files Browse the repository at this point in the history
Update: miscellaneous
  • Loading branch information
AlbertoCuadra committed Apr 11, 2023
2 parents 0ad6c02 + 069d87a commit bbbb734
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 6 additions & 3 deletions gui/utils/gui_seeker_exact_value.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
index = index + 1;
seekIndex = strcmp(ListValues{index}, seekValue);
end

if index
value = ListValues{index}; % Value found in ListValues
else
value = []; % Value not found in ListValues
end

catch ME
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf('%s\n', errorMessage);
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf('%s\n', errorMessage);
end

end
12 changes: 8 additions & 4 deletions gui/utils/gui_seeker_value.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
value = [];
return
end

for i = length(ListValues):-1:1
seekIndex(i) = startsWith(ListValues{i}, seekValue, 'IgnoreCase', false);
end

if any(seekIndex)
value = ListValues(seekIndex); % Value found in ListValues
else
value = []; % Value not found in ListValues
end

catch ME
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf('%s\n', errorMessage);
uiwait(warndlg(errorMessage));
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf('%s\n', errorMessage);
uiwait(warndlg(errorMessage));
end

end
3 changes: 2 additions & 1 deletion utils/create_cell_ntimes.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function C = create_cell_ntimes(varargin)
% Create cell array with the same item n-times

if nargin > 2
value = varargin{1};
C = varargin{3};
Expand All @@ -8,7 +9,7 @@
n = varargin{2};
C = cell(1, n);
else
error('Error sub-pass fuinction @create_cell_ntimes inside @guiReactantsValueChanged');
error('Error sub-pass function @create_cell_ntimes inside @guiReactantsValueChanged');
end

% Set value
Expand Down

0 comments on commit bbbb734

Please sign in to comment.