Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from AlbertoCuadra/develop
Add: new functionalities
- Loading branch information
Showing
7 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function value = gui_seeker_value(obj, event, ListValues) | ||
% Return the value that match with the value introduced in the finder | ||
try | ||
seekValue = event.Value; | ||
index = 0; | ||
seekIndex = false; | ||
while ~seekIndex | ||
index = index + 1; | ||
seekIndex = startsWith(ListValues{index}, seekValue, 'IgnoreCase', false); | ||
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); | ||
uiwait(warndlg(errorMessage)); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function LS = gui_value2list(obj, value, LS, action) | ||
% Add/remove (action) selected value to LS | ||
if ~isempty(value) | ||
switch lower(action) | ||
case 'add' | ||
LS = add_value(value, LS); | ||
case 'remove' | ||
LS = remove_value(value, LS); | ||
end | ||
end | ||
end | ||
|
||
% SUB-PASS FUNCTIONS | ||
function LS = add_value(value, LS) | ||
% Add value to LS | ||
|
||
% Check if the value is already included in the list | ||
n_pass = []; | ||
for n = length(value):-1:1 | ||
if ~any(strcmp(LS, value{n})) | ||
n_pass = [n_pass, n]; | ||
end | ||
end | ||
LS = [LS, value(n_pass)]; | ||
end | ||
|
||
function LS = remove_value(value, LS) | ||
% Remove value from LS | ||
|
||
% Remove the species from the list | ||
N = length(LS); | ||
n_pass = true(1, N); | ||
for n = N:-1:1 | ||
if any(strcmp(value, LS{n})) | ||
n_pass(n) = false; | ||
end | ||
end | ||
LS = LS(n_pass); | ||
end |
Binary file not shown.
Binary file not shown.