Loading GUI.m +10 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,11 @@ classdef GUI < handle obj.settings = Settings(); if isfield(obj.Data.settings,'set') obj.settings.setvalues(obj.Data.settings); else obj.settings.init(); end obj.initialized = 1; obj.Data.open = 1; Loading Loading @@ -1176,6 +1180,11 @@ classdef GUI < handle object.Data.function_inputs = get(object.function_inputs_control,'String') object.Data.open = 0; object.Data.fig = []; set.set = 1; set.inputs = object.settings.pvs_includes; set.count = object.settings.counter_trials; set.range = object.settings.counter_range; object.Data.settings = set; % delete the figure, closing the window. delete(object.fig); % remove reference to the old figure. Loading Settings.m +53 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ classdef Settings < handle label_width = 75; text_offset = 10; inlude_text = [] include_text = [] count_text = [] range_text = [] end Loading @@ -39,6 +39,12 @@ classdef Settings < handle end function [] = setvalues(obj,settings) obj.pvs_includes = settings.inputs; obj.counter_trials = settings.count; obj.counter_range = settings.range; end function [] = show(obj) if (obj.open) figure(obj.fig) Loading Loading @@ -109,9 +115,10 @@ classdef Settings < handle elipse_width = 20; % import text box uicontrol('style','edit',... obj.include_text = uicontrol('style','edit',... 'units','pix',... 'Parent',panel,... 'String',obj.pvs_includes,... 'HorizontalAlign','center',... 'BackgroundColor',get(obj.fig,'Color'),... 'Position',[obj.text_offset+obj.label_width, panel_height-obj.text_offset*2-obj.label_height, panel_width - (obj.text_offset*3+obj.label_width+elipse_width), obj.label_height]); Loading Loading @@ -175,13 +182,49 @@ classdef Settings < handle end function [] = elipse_call(obj,src,event) uigetfile files = uigetfile('*.pvs','Select pvs files','MultiSelect','on'); string = []; if iscell(files) for i = 1:size(files,2) string = strcat(string,files(i)) %string = [string, files(i)]; if i ~= size(files,2) string = strcat(string,', ') %string = [string, ','] end end else string = files; end set(obj.include_text,'String',char(string)); end function [] = apply_call(obj,src,event) function err = save(obj) msg = [] err = 0; if isempty(str2num(get(obj.count_text,'String'))) msg = [msg get(obj.count_text,'String') ' is not a valid number'] err = 1; else obj.counter_trials = str2num(get(obj.count_text,'String')) end if isempty(str2num(get(obj.range_text,'String'))) msg = [msg sprintf('\n') get(obj.count_text,'String') ' is not a valid number'] err = 1; else obj.counter_range = str2num(get(obj.range_text,'String')) end obj.pvs_includes = get(obj.include_text,'String') if err msgbox(msg); end end function err = apply_call(obj,src,event) obj.save end function [] = cancel_call(obj,src,event) Loading @@ -190,8 +233,9 @@ classdef Settings < handle function [] = ok_call(obj,src,event) obj.apply_call([],[]); if ~(obj.save); obj.close_fig([],[]); end end Loading Loading
GUI.m +10 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,11 @@ classdef GUI < handle obj.settings = Settings(); if isfield(obj.Data.settings,'set') obj.settings.setvalues(obj.Data.settings); else obj.settings.init(); end obj.initialized = 1; obj.Data.open = 1; Loading Loading @@ -1176,6 +1180,11 @@ classdef GUI < handle object.Data.function_inputs = get(object.function_inputs_control,'String') object.Data.open = 0; object.Data.fig = []; set.set = 1; set.inputs = object.settings.pvs_includes; set.count = object.settings.counter_trials; set.range = object.settings.counter_range; object.Data.settings = set; % delete the figure, closing the window. delete(object.fig); % remove reference to the old figure. Loading
Settings.m +53 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ classdef Settings < handle label_width = 75; text_offset = 10; inlude_text = [] include_text = [] count_text = [] range_text = [] end Loading @@ -39,6 +39,12 @@ classdef Settings < handle end function [] = setvalues(obj,settings) obj.pvs_includes = settings.inputs; obj.counter_trials = settings.count; obj.counter_range = settings.range; end function [] = show(obj) if (obj.open) figure(obj.fig) Loading Loading @@ -109,9 +115,10 @@ classdef Settings < handle elipse_width = 20; % import text box uicontrol('style','edit',... obj.include_text = uicontrol('style','edit',... 'units','pix',... 'Parent',panel,... 'String',obj.pvs_includes,... 'HorizontalAlign','center',... 'BackgroundColor',get(obj.fig,'Color'),... 'Position',[obj.text_offset+obj.label_width, panel_height-obj.text_offset*2-obj.label_height, panel_width - (obj.text_offset*3+obj.label_width+elipse_width), obj.label_height]); Loading Loading @@ -175,13 +182,49 @@ classdef Settings < handle end function [] = elipse_call(obj,src,event) uigetfile files = uigetfile('*.pvs','Select pvs files','MultiSelect','on'); string = []; if iscell(files) for i = 1:size(files,2) string = strcat(string,files(i)) %string = [string, files(i)]; if i ~= size(files,2) string = strcat(string,', ') %string = [string, ','] end end else string = files; end set(obj.include_text,'String',char(string)); end function [] = apply_call(obj,src,event) function err = save(obj) msg = [] err = 0; if isempty(str2num(get(obj.count_text,'String'))) msg = [msg get(obj.count_text,'String') ' is not a valid number'] err = 1; else obj.counter_trials = str2num(get(obj.count_text,'String')) end if isempty(str2num(get(obj.range_text,'String'))) msg = [msg sprintf('\n') get(obj.count_text,'String') ' is not a valid number'] err = 1; else obj.counter_range = str2num(get(obj.range_text,'String')) end obj.pvs_includes = get(obj.include_text,'String') if err msgbox(msg); end end function err = apply_call(obj,src,event) obj.save end function [] = cancel_call(obj,src,event) Loading @@ -190,8 +233,9 @@ classdef Settings < handle function [] = ok_call(obj,src,event) obj.apply_call([],[]); if ~(obj.save); obj.close_fig([],[]); end end Loading