📄 gui_cb.m
字号:
set(hpm_FastICA_g, 'String', g_str);
% Match the old g value from the new g values so that if the
% old_g can be found from the new values (anywhere), then set new g
% to that value, and if it's not found then set the new value to 1.
match = 0;
eval(['g_str = c_FastICA_g' int2str(g_FastICA_approach) '_strV;']);
for i=1:size(g_str,1)
if strcmp(old_g, deblank(g_str(i,:)))
match = i;
end
end
if match == 0
match = 1; % the old g is not availabe anymore, set g = 1.
end
g_FastICA_g = match;
set(hpm_FastICA_g, 'Value', match);
gui_cb NullICA; % The options are changed so we must calculate ICA again
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'ChangeNumOfIC'
% Get the new value... and store it later on after some checks
numofic = str2num(get(he_FastICA_numOfIC, 'String'));
% The number of IC can't be less than 1 or more than the reduced dimension.
numoficmax = str2num(get(ht_FastICA_newDim, 'String'));
if numofic < 1
set(he_FastICA_numOfIC, 'String', '1');
g_FastICA_numOfIC = 1;
elseif numofic > numoficmax
set(he_FastICA_numOfIC, 'String', int2str (numoficmax));
g_FastICA_numOfIC = numoficmax;
else
g_FastICA_numOfIC = numofic;
end
gui_cb NullICA; % The options are changed so we must calculate ICA again
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'ChangeG'
% Get the new value for g.
g_FastICA_g = get(hpm_FastICA_g, 'Value');
gui_cb NullICA; % The options are changed so we must calculate ICA again
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'ChangeStab'
% Get the new value for g.
g_FastICA_stabilization = get(hpm_FastICA_stabilization, 'Value');
gui_cb NullICA; % The options are changed so we must calculate ICA again
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'AdvOpt'
handle = findobj('Tag','f_FastICAAdvOpt');
if isempty(handle) % Check to see if the window is
pos = get(hf_FastICA_MAIN, 'Position'); % already open...
gui_adv(pos(1), pos(2));
else
figure(handle)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'ShowICASig'
if ~isempty(g_FastICA_mixedsig)
% If the IC's are not already calculated, we'll do it now
if isempty(g_FastICA_ica_sig)
gui_cb DoFPICA;
end
% The signals may have been already displaued by the FPICA function
% BUT the FPICA may also have shown either the basis of the filters
% so the signals still need to be shown - besides the mean was added
% in only later after FPICA
% Also notice that in this version if there was something wrong in FPICA
% Then the results are []. - We don't try to plot them!
if ~isempty(g_FastICA_ica_sig')
handle = findobj('Tag','f_FastICA_ica'); % Check if the window is already
if isempty(handle) % open. If not then open it.
figure('Tag', 'f_FastICA_ica', ...
'Name', 'FastICA: Plot ICs', ...
'NumberTitle', 'off');
else
figure(handle);
clf; % clear the figure for next plots
end
icaplot('dispsig', g_FastICA_ica_sig, 0, ...
0, 0, 'Independent components');
end
else
fprintf('Data not loaded yet!\n\n');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'DoFPICA'
gui_cb DisableButtons;
g_FastICA_interrupt = 0;
if ~isempty(g_FastICA_mixedsig)
if isempty(g_FastICA_white_sig) % We need the whitened signal here
gui_cb Whiten;
end
set(ht_FastICA_icaStatus,'String','Computing...');
% The possible values for g depend on approach
eval(['g_str = c_FastICA_g' int2str(g_FastICA_approach) '_strV;']);
% We'll contruct a command string which we'll later on evaluate...
% This is where the Fixed point algorithm is used.
command_str = ['[g_FastICA_ica_A,g_FastICA_ica_W]=' ...
'fpica(g_FastICA_white_sig,' ...
'g_FastICA_white_wm,' ...
'g_FastICA_white_dwm,' ...
'''' deblank(c_FastICA_appr_strV(g_FastICA_approach,:)) ...
''',' ...
'g_FastICA_numOfIC,' ...
'''' deblank(g_str(g_FastICA_g,:)) ''',' ...
'''' ...
deblank(c_FastICA_finetune_strV(g_FastICA_finetune,:)) ...
''',' ...
'g_FastICA_a1,' ...
'g_FastICA_a2,' ...
'g_FastICA_myy,' ...
'''' ...
deblank(c_FastICA_stabili_strV(g_FastICA_stabilization,:)) ...
''',' ...
'g_FastICA_epsilon,' ...
'g_FastICA_maxNumIte,' ...
'g_FastICA_maxFinetune,' ...
'''' deblank(c_FastICA_iSta_strV(g_FastICA_initState,:)) ...
''',' ...
'g_FastICA_initGuess,' ...
'g_FastICA_sampleSize,' ...
'''' deblank(c_FastICA_dMod_strV(g_FastICA_displayMo,:)) ...
''',' ...
'g_FastICA_displayIn,' ...
'''' deblank(c_FastICA_verb_strV(g_FastICA_verbose,:)) ...
''');'];
% If the user wants to plot while computing...
% let's at least plot it to the right figure then
if ~strcmp(deblank(c_FastICA_dMod_strV(g_FastICA_displayMo,:)),'off')
handle = findobj('Tag','f_FastICA_ica'); % Check if the window is already
if isempty(handle) % open. If not then open it.
figure('Tag', 'f_FastICA_ica', ...
'Name', 'FastICA: Plot ICs', ...
'NumberTitle', 'off');
else
figure(handle);
clf; % clear the figure for next plots
end
end
% ... and so let's do it...
eval(command_str);
% Also notice that in this version if there was something wrong in FPICA
% Then the results are [].
if ~isempty(g_FastICA_ica_W)
% Add the mean back in.
g_FastICA_ica_sig = g_FastICA_ica_W * g_FastICA_mixedsig ...
+ (g_FastICA_ica_W * g_FastICA_mixedmean) ...
* ones(1,size(g_FastICA_mixedsig, 2));
set (ht_FastICA_icaStatus,'String','Done');
else
gui_cb NullICA; % set icasig=[] and do what ever needs to be done then
end
if ~(g_FastICA_interrupt)
gui_cb EnableButtons;
end
else
fprintf('Data not loaded yet!\n\n');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Interrupt'
g_FastICA_interrupt = 1;
set(ht_FastICA_icaStatus,'String','Interrupted');
gui_cb EnableButtons;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'DisableButtons'
set(findobj('Tag','b_Transpose'),'Enable','off');
set(findobj('Tag','b_ShowMixed'),'Enable','off');
set(findobj('Tag','b_DoPCA'),'Enable','off');
set(findobj('Tag','b_OrigDim'),'Enable','off');
set(findobj('Tag','b_ShowWhite'),'Enable','off');
set(findobj('Tag','b_advOpt'),'Enable','off');
set(findobj('Tag','b_ShowICASig'),'Enable','off');
set(findobj('Tag','b_LoadData'),'Enable','off');
set(findobj('Tag','b_DoFPICA'),'Enable','off');
set(findobj('Tag','b_SaveData'),'Enable','off');
set(findobj('Tag','b_Quit'),'Enable','off');
set(findobj('Tag','b_Interrupt'),'Visible','on');
drawnow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'EnableButtons'
set(findobj('Tag','b_Transpose'),'Enable','on');
set(findobj('Tag','b_ShowMixed'),'Enable','on');
set(findobj('Tag','b_DoPCA'),'Enable','on');
set(findobj('Tag','b_OrigDim'),'Enable','on');
set(findobj('Tag','b_ShowWhite'),'Enable','on');
set(findobj('Tag','b_advOpt'),'Enable','on');
set(findobj('Tag','b_ShowICASig'),'Enable','on');
set(findobj('Tag','b_LoadData'),'Enable','on');
set(findobj('Tag','b_DoFPICA'),'Enable','on');
set(findobj('Tag','b_SaveData'),'Enable','on');
set(findobj('Tag','b_Quit'),'Enable','on');
set(findobj('Tag','b_Interrupt'),'Visible','off');
drawnow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'SaveData'
handle = findobj('Tag','f_FastICASave'); % Check if the window is already
if isempty(handle) % open. If not then open it.
pos = get(hf_FastICA_MAIN, 'Position');
gui_s(pos(1), pos(2));
else
figure(handle); % window. If it wasn't then
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Quit'
% We'll close the other dialogs if they are open.
Tags = ['f_FastICALoad '
'f_FastICAAdvOpt'
'f_FastICASave '
'f_FastICA_mix '
'f_FastICA_white'
'f_FastICA_ica '];
for i=1:size(Tags,1)
handle = findobj('Tag', deblank(Tags(i,:)));
if ~isempty(handle)
close(handle);
end
end
% Close this window
close(hf_FastICA_MAIN);
% Clear the used global variables.
gui_cg;
% Use break to 'jump' over the watchoff statement at the end
break;
% ... and we're done.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'About'
gui_help('gui_cb_about');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Help'
gui_help('gui_cb_help');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end % switch
watchoff (watchonInFigure);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -