0001 function [meginfo, new_ref_pick, new_ref_Qpick] = ...
0002 vb_meginfo_solve_extra_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
0028
0029
0030
0031
0032
0033
0034
0035 if ~exist('meginfo', 'var'), meginfo = []; end
0036 if ~exist('ref_pick', 'var'), ref_pick = []; end
0037 if ~exist('ref_Qpick', 'var'), ref_Qpick = []; end
0038 if ~exist('ch_name', 'var'), ch_name = ''; end
0039 [meginfo, ref_pick, ref_Qpick, ch_name] = ...
0040 inner_check_arguments(meginfo, ref_pick, ref_Qpick, ch_name);
0041
0042
0043
0044
0045
0046 new_ref_pick = [];
0047 new_ref_Qpick = [];
0048
0049
0050 refmg_ch_label = vb_meginfo_get_channel_label_refmg(meginfo);
0051 allex_ch_label = vb_meginfo_get_channel_label_extra(meginfo, false, true);
0052
0053 if ~isfield(meginfo, 'ExtraChannelInfo') ...
0054 || isempty(ch_name) ...
0055 || isempty(allex_ch_label)
0056
0057
0058 ex_info.Channel_active = [];
0059 ex_info.Channel_name = {};
0060 ex_info.Channel_type = [];
0061 ex_info.Channel_id = [];
0062 meginfo.ExtraChannelInfo = ex_info;
0063
0064
0065 meginfo = vb_meginfo_set_sensor_weight_refmg(meginfo, []);
0066 return;
0067 end
0068
0069
0070
0071
0072 if ~isempty(allex_ch_label) && ~isempty(ch_name)
0073 [idx] = vb_util_get_index(allex_ch_label, ch_name);
0074
0075 ex_info = meginfo.ExtraChannelInfo;
0076
0077 meginfo.ExtraChannelInfo.Channel_active = ex_info.Channel_active(idx);
0078 meginfo.ExtraChannelInfo.Channel_name = ex_info.Channel_name(idx);
0079 meginfo.ExtraChannelInfo.Channel_type = ex_info.Channel_type(idx);
0080 meginfo.ExtraChannelInfo.Channel_id = ex_info.Channel_id(idx);
0081
0082
0083 [idx_ref] = vb_util_get_index(refmg_ch_label, ch_name);
0084 if ~isempty(ref_pick)
0085 new_ref_pick = ref_pick(idx_ref, :);
0086 end
0087
0088 if ~isempty(ref_Qpick)
0089 new_ref_Qpick = ref_Qpick(idx_ref, :);
0090 end
0091
0092 if vb_meginfo_sensor_weight_refmg_exist(meginfo)
0093 reflen = length(idx_ref);
0094 meginfo = vb_meginfo_init_sensor_weight_refmg(meginfo, reflen);
0095 end
0096
0097 else
0098 meginfo.ExtraChannelInfo.Channel_active = [];
0099 meginfo.ExtraChannelInfo.Channel_name = [];
0100 meginfo.ExtraChannelInfo.Channel_type = [];
0101 meginfo.ExtraChannelInfo.Channel_id = [];
0102 end
0103 return;
0104
0105
0106
0107
0108
0109
0110
0111 function [meginfo, ref_pick, ref_Qpick, ch_name] = ...
0112 inner_check_arguments(meginfo, ref_pick, ref_Qpick, ch_name)
0113 func_ = mfilename;
0114 if isempty(meginfo)
0115 error('(%s)meginfo is a required parameter', func_);
0116 end
0117
0118 if isempty(ref_pick)
0119
0120 end
0121
0122 if isempty(ref_Qpick)
0123
0124 end
0125
0126 if ~isempty(ch_name) && ~iscell(ch_name)
0127 ch_name = {ch_name};
0128 end
0129 return;
0130
0131
0132
0133
0134
0135