Home > functions > gui > preAnalysis > yokogawa_meg > pa_yokogawa_meg_edit_extra_channel_gain.m

pa_yokogawa_meg_edit_extra_channel_gain

PURPOSE ^

Edit and save extra channel gain.

SYNOPSIS ^

function pa_yokogawa_meg_edit_extra_channel_gain(fig)

DESCRIPTION ^

 Edit and save extra channel gain.
 [USAGE]
    pa_yokogawa_meg_edit_extra_channel_gain(<fig>);
 [IN]
    fig : figure handle of yokogawa meg gui.
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pa_yokogawa_meg_edit_extra_channel_gain(fig)
0002 % Edit and save extra channel gain.
0003 % [USAGE]
0004 %    pa_yokogawa_meg_edit_extra_channel_gain(<fig>);
0005 % [IN]
0006 %    fig : figure handle of yokogawa meg gui.
0007 % [OUT]
0008 %    none
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 %
0014 % --- Previous check
0015 %
0016 
0017 % load data(@see pa_yokogawa_meg_create)
0018 data = guidata(fig);
0019 H = data.H;
0020 
0021 
0022 %
0023 % --- read extra channel info from Yokogawa MEG file.
0024 %
0025 meg_file = get(H.meg_file_edit, 'String');
0026 if exist(meg_file, 'file') ~= 2
0027     errordlg('Cannot open MEG file.', 'error');
0028     return;
0029 end
0030 % load extra channel name definition and init gain value
0031 ex_all_name = vb_ykgwfile_load_channel_name_extra(meg_file, []);
0032 ex_all_gain = zeros(length(ex_all_name), 1);
0033 if isempty(ex_all_name)
0034     errordlg('Extra channel definition cannot be found in MEG file.');
0035     return;
0036 end
0037 
0038 % Set current inputted gain value into ex_all_gain.
0039 ex_ch_gain = data.yokogawa_meg_parm.ex_ch_gain;
0040 if ~isempty(ex_ch_gain)
0041     % channel name & previous inputted gain value
0042     inputted_ch_list = {ex_ch_gain.name};
0043     for k=1:length(inputted_ch_list)
0044         ix = strmatch(inputted_ch_list{k}, ex_all_name);
0045         ex_all_gain(ix) = ex_ch_gain(k).value;
0046     end
0047 end
0048 
0049 % edit gain value
0050 [editted_gain, cancelled] = gain_input('init', ex_all_name, ex_all_gain);
0051 
0052 if cancelled || isempty(editted_gain), return; end
0053 
0054 ret_ch_name  = editted_gain(:, 1);
0055 ret_gain     = editted_gain(:, 2);
0056 
0057 %
0058 % --- make extra_gain array(This format is defined meg_parm.extra_gain)
0059 %
0060 ex_ch_gain = [];
0061 for k=1:length(ret_ch_name)
0062     ex_ch_gain = [ex_ch_gain; ...
0063                   struct('name', ret_ch_name{k}, 'value', ret_gain{k})];
0064 end
0065 
0066 % set local meg_parm
0067 data.yokogawa_meg_parm.ex_ch_gain = ex_ch_gain;
0068 
0069 set(H.gain_setting_text, 'String', 'Specified');
0070 
0071 % save data
0072 guidata(fig, data);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005