from
CoCoMac
by James Allen Download CoCoMac.org cortical connectivity data, model it as a network, and simulate epileptic sprea
fc_remove_from_listbox(list_selected_nodes)
function [] = fc_remove_from_listbox(list_selected_nodes)
% Removes the selected items in the list box designated with handle
% 'list_selected_nodes'
deletion_values = get(list_selected_nodes, 'Value'); % gets a matrix of numbers indicating index(s) of string(s) chosen for deletion by user
selected_nodes = get(list_selected_nodes, 'String'); % get the list of nodes from the listbox
new_selected_nodes = {}; %new cell array for the list of nodes without ones selected for deletion
[no_of_nodes dummy] = size(selected_nodes);
% Loop through every item in listbox
% search deletion indexes for index of current listbox item - returns array
% of 0s and 1s - 1s indicate the index is one for deletion
for removeCounter = 1 : no_of_nodes
is_deleted = (removeCounter == deletion_values);
if (sum(is_deleted) == 0) % if there were no 1s....
new_selected_nodes{end+1} = selected_nodes{removeCounter}; % the list item is NOT for deletion, so add to new list
end
end
set(list_selected_nodes, 'Value', 1);
set(list_selected_nodes, 'String', new_selected_nodes);
% Make animation panel invisible - because you need to run simulation first
% to update the activ matrix
set(findobj('tag', 'panel_animation'), 'visible', 'off');
set(findobj('tag', 'animation_frame_label'), 'visible', 'off');
set(findobj('tag', 'animation_frame_editbox'), 'visible', 'off');
set(findobj('tag', 'animation_slider'), 'visible', 'off');
return;