0001 function [meginfo, new_ref_pick, new_ref_Qpick] = ...
0002 vb_meginfo_solve_refmg_channel(meginfo, ref_pick, ref_Qpick, ch_name)
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 if ~exist('meginfo', 'var'), meginfo = []; end
0028 if ~exist('ref_pick', 'var'), ref_pick = []; end
0029 if ~exist('ref_Qpick', 'var'), ref_Qpick = []; end
0030 if ~exist('ch_name', 'var'), ch_name = ''; end
0031 [meginfo, ref_pick, ref_Qpick, ch_name] = ...
0032 inner_check_arguments(meginfo, ref_pick, ref_Qpick, ch_name);
0033
0034
0035
0036 if ~isfield(meginfo, 'ExtraChannelInfo') || isempty(ch_name)
0037
0038 return;
0039 end
0040
0041 ext_ch = vb_meginfo_get_channel_label_extra(meginfo, false);
0042
0043
0044 ext_ch = vb_util_arrange_list(ext_ch, 0);
0045 ch_name = vb_util_arrange_list(ch_name, 0);
0046 new_ext_ch_name = [ext_ch; ch_name];
0047
0048 base_ch_label = meginfo.ExtraChannelInfo.Channel_name;
0049
0050 if ~isempty(base_ch_label)
0051 [idx] = vb_util_get_index(base_ch_label, new_ext_ch_name);
0052
0053 ex_info = meginfo.ExtraChannelInfo;
0054
0055
0056 ref_ch = vb_meginfo_get_channel_label_refmg(meginfo);
0057 ref_idx = vb_util_get_index(ref_ch, ch_name);
0058
0059 new_ref_pick = ref_pick(ref_idx, :);
0060 new_ref_Qpick = ref_Qpick(ref_idx, :);
0061
0062 if vb_meginfo_sensor_weight_refmg_exist(meginfo)
0063 org_weight = vb_meginfo_get_sensor_weight_refmg(meginfo);
0064 meginfo = ...
0065 vb_meginfo_set_sensor_weight_refmg(meginfo, org_weight(ref_idx,ref_idx));
0066 end
0067
0068
0069 meginfo.ExtraChannelInfo.Channel_active = ex_info.Channel_active(idx);
0070 meginfo.ExtraChannelInfo.Channel_name = ex_info.Channel_name(idx);
0071 meginfo.ExtraChannelInfo.Channel_type = ex_info.Channel_type(idx);
0072 meginfo.ExtraChannelInfo.Channel_id = ex_info.Channel_id(idx);
0073
0074 else
0075 meginfo.ExtraChannelInfo.Channel_active = [];
0076 meginfo.ExtraChannelInfo.Channel_name = [];
0077 meginfo.ExtraChannelInfo.Channel_type = [];
0078 meginfo.ExtraChannelInfo.Channel_id = [];
0079
0080 meginfo = vb_meginfo_set_sensor_weight_refmg(meginfo, []);
0081 end
0082 return;
0083
0084
0085
0086
0087
0088
0089
0090 function [meginfo, ref_pick, ref_Qpick, ch_name] = ...
0091 inner_check_arguments(meginfo, ref_pick, ref_Qpick, ch_name)
0092 func_ = mfilename;
0093 if isempty(meginfo)
0094 error('(%s)meginfo is a required parameter', func_);
0095 end
0096
0097 if isempty(ref_pick)
0098
0099 end
0100
0101 if isempty(ref_Qpick)
0102
0103 end
0104
0105 if ~isempty(ch_name) && ~iscell(ch_name)
0106 ch_name = {ch_name};
0107 end
0108 return;
0109
0110
0111
0112
0113
0114