ctf_read_gui.m
来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 448 行 · 第 1/2 页
M
448 行
boxdepth = 0.15;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CTF Data Selection and ParametersFont.FontWeight = 'bold';% BROWSE for a .ds folderbrowsecommand = strcat('CTFopen = get(gcbf,''Userdata'');',... 'ctf = CTFopen.ctf; ',... 'ctf = ctf_folder([],ctf); ',... 'ctf = ctf_read_res4(ctf.folder); ',... 'CTFopen.ctf = ctf; ',... 'set(CTFopen.handles.EctfFolder,''String'',ctf.folder); ',... 'set(gcbf,''Userdata'',CTFopen);',... 'clear CTFopen; ctf = ctf_read_gui(''update'');');G.BctfFile = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized',Font, ... 'Position',[.01 .80 .17 boxdepth], 'String','CTF Folder (*.ds)',... 'BackgroundColor',[0.8 0.8 0.0], 'ForegroundColor', [1 1 1], ... 'HorizontalAlignment', 'center', ... 'TooltipString','Browse for CTF folder', ... 'Callback', browsecommand );Font.FontWeight = 'normal';% EDIT the .ds folder nameeditcommand = strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.ctf.folder = get(CTFopen.handles.EctfFolder,''String''); ',... 'ctf = CTFopen.ctf; ',... 'ctf = ctf_folder(ctf.folder,ctf); ',... 'ctf = ctf_read_res4(ctf.folder); ',... 'CTFopen.ctf = ctf; ',... 'set(CTFopen.handles.EctfFolder,''String'',ctf.folder); ',... 'set(gcbf,''Userdata'',CTFopen);',... 'clear CTFopen; ctf = ctf_read_gui(''update'');');G.EctfFolder = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ... 'Position',[.20 .80 .75 boxdepth], 'String',ctf.folder,... 'Callback', editcommand );%---------------------------------------------------------------% Channelsheight = 0.6;G.Title_channels = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ... 'Position',[.01 height .17 boxdepth],'HorizontalAlignment', 'center','String','Channels:');% Channel typesCTFopen.channeltypes = {'all', 'eeg', 'meg', 'ref', 'other', '[array]'};channelpopup = strcat('CTFopen = get(gcbf,''Userdata'');',... 'channelvalue = get(CTFopen.handles.PctfCHANNELS,''Value''); ',... 'channeltype = CTFopen.channeltypes{channelvalue}; ',... 'switch channeltype, ',... ' case ''all'', CTFopen.CHANNELS = 1:CTFopen.ctf.setup.number_channels; ',... ' case ''eeg'', CTFopen.CHANNELS = CTFopen.ctf.sensor.index.eeg; ',... ' case ''meg'', CTFopen.CHANNELS = CTFopen.ctf.sensor.index.meg; ',... ' case ''ref'', CTFopen.CHANNELS = CTFopen.ctf.sensor.index.ref; ',... ' case ''other'', CTFopen.CHANNELS = CTFopen.ctf.sensor.index.other; ',... ' otherwise, CTFopen.CHANNELS = []; ',... 'end; ',... 'set(CTFopen.handles.EctfCHANNELS,''Value'',CTFopen.CHANNELS); ',... 'set(CTFopen.handles.EctfCHANNELS,''string'',num2str(CTFopen.CHANNELS)); ',... 'set(gcbf,''Userdata'',CTFopen);',... 'clear CTFopen channelvalue channeltype;');G.PctfCHANNELS = uicontrol('Parent',GUI,'Style','popup','Units','Normalized',Font, ... 'Position',[.20 height .20 boxdepth], ... 'String',CTFopen.channeltypes,... 'Value',1, ... 'TooltipString','Channel selection - enter values for [array]', ... 'Callback', channelpopup );% Channels arraychannelarray = strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.CHANNELS = str2num(get(CTFopen.handles.EctfCHANNELS,''String'')); ',... 'set(CTFopen.handles.EctfCHANNELS,''Value'',CTFopen.CHANNELS); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;');G.EctfCHANNELS = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ... 'Position',[.40 height .50 boxdepth], ... 'String',num2str(CTFopen.CHANNELS),'Value',CTFopen.CHANNELS,... 'TooltipString','Channels array - enter values for [array] selection', ... 'Callback', channelarray );G.EctfCHANNELSCLEAR = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized',Font, ... 'Position',[.90 height .05 boxdepth], ... 'String','Clear',... 'TooltipString','Clear channels array', ... 'Callback', strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.CHANNELS = []; ',... 'set(CTFopen.handles.EctfCHANNELS,''String'',''''); ',... 'set(CTFopen.handles.EctfCHANNELS,''Value'',CTFopen.CHANNELS); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;') );%---------------------------------------------------------------% Timeheight = 0.4;G.Title_channels = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ... 'Position',[.01 height .17 boxdepth],'HorizontalAlignment', 'center','String','Time (sec):');% Time arraystart = sprintf('%6.5f', CTFopen.TIME(1));step = sprintf('%6.5f',[CTFopen.TIME(2) - CTFopen.TIME(1)]);stop = sprintf('%6.5f', CTFopen.TIME(end));timestring = [start,':',step,':',stop];G.TctfTIME = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ... 'Position',[.20 height .20 boxdepth],'HorizontalAlignment', 'center',... 'TooltipString','Time array (sec)', ... 'String',timestring);timearray = strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.TIME = str2num(get(CTFopen.handles.EctfTIME,''String''))''; ',... 'set(CTFopen.handles.EctfTIME,''Value'',CTFopen.TIME); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;');G.EctfTIME = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ... 'Position',[.40 height .50 boxdepth], ... 'String',num2str(CTFopen.TIME'),'Value',CTFopen.TIME,... 'TooltipString','Time array (sec)', ... 'Callback', timearray );G.EctfTIMECLEAR = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized',Font, ... 'Position',[.90 height .05 boxdepth], ... 'String','Clear',... 'TooltipString','Clear time array', ... 'Callback', strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.TIME = []; ',... 'set(CTFopen.handles.EctfTIME,''String'',''''); ',... 'set(CTFopen.handles.EctfTIME,''Value'',CTFopen.TIME); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;') );%---------------------------------------------------------------% Trialsheight = 0.2;G.Title_trials = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ... 'Position',[.01 height .17 boxdepth],'HorizontalAlignment', 'center','String','Trials:');start = num2str(CTFopen.TRIALS(1));stop = num2str(CTFopen.TRIALS(end));trialstring = [start,':',stop];G.TctfTRIALS = uicontrol('Parent',GUI,'Style','text','Units','Normalized',Font, ... 'Position',[.20 height .20 boxdepth],'HorizontalAlignment', 'center',... 'String',trialstring);% Trials arraytrialsarray = strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.TRIALS = str2num(get(CTFopen.handles.EctfTRIALS,''String'')); ',... 'set(CTFopen.handles.EctfTRIALS,''Value'',CTFopen.TRIALS); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;');G.EctfTRIALS = uicontrol('Parent',GUI,'Style','edit','Units','Normalized',Font, ... 'Position',[.40 height .50 boxdepth], ... 'String',num2str(CTFopen.TRIALS),'Value',CTFopen.TRIALS,... 'TooltipString','Trials array', ... 'Callback', trialsarray );G.EctfTRIALSCLEAR = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized',Font, ... 'Position',[.90 height .05 boxdepth], ... 'String','Clear',... 'TooltipString','Clear trials array', ... 'Callback', strcat('CTFopen = get(gcbf,''Userdata'');',... 'CTFopen.TRIALS = []; ',... 'set(CTFopen.handles.EctfTRIALS,''String'',''''); ',... 'set(CTFopen.handles.EctfTRIALS,''Value'',CTFopen.TRIALS); ',... 'set(gcbf,''Userdata'',CTFopen); clear CTFopen;') );% % PLOT: Load & plot the data!% G.Bplot = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...% 'Position',[.20 .01 .18 .2],...% 'String','PLOT','BusyAction','queue',...% 'TooltipString','Plot the EEG data and return p struct.',...% 'BackgroundColor',[0.0 0.5 0.0],...% 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...% 'Callback',strcat('CTFopen = get(gcbf,''Userdata'');',...% 'p = ctf_read_gui(CTFopen.p,''plot'');',...% 'clear CTFopen;'));% % % Save As% G.Bsave = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ...% 'Position',[.40 .01 .18 .2],'HorizontalAlignment', 'center',...% 'String','SAVE AS','TooltipString','EEG File Conversion Tool (not implemented yet)',...% 'BusyAction','queue',...% 'Visible','off',...% 'BackgroundColor',[0.0 0.0 0.75],...% 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',...% 'Callback',strcat('CTFopen = get(gcbf,''Userdata'');',...% 'p = ctf_read_gui(CTFopen.p,''save'');',...% 'clear CTFopen;'));Font.FontWeight = 'bold';% Quit, return file parametersG.Breturn = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ... 'Position',[.70 .01 .10 boxdepth],... 'String','RETURN','BusyAction','queue',... 'TooltipString','Return p struct to workspace and parent GUI.',... 'BackgroundColor',[0.0 0.75 0.0],... 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',... 'Callback','ctf = ctf_read_gui(''return'');' );% CancelG.Bcancel = uicontrol('Parent',GUI,'Style','pushbutton','Units','Normalized', Font, ... 'Position',[.85 .01 .10 boxdepth],... 'String','CANCEL','BusyAction','queue',... 'TooltipString','Close, do not read data.',... 'BackgroundColor',[0.75 0.0 0.0],... 'ForegroundColor', [1 1 1], 'HorizontalAlignment', 'center',... 'Callback','close(gcbf);');% Store userdataCTFopen.gui = GUI; CTFopen.handles = G;CTFopen.ctf = ctf;set(GUI,'Userdata',CTFopen);set(GUI,'HandleVisibility','callback');return
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?