Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: miscellaneous #875

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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