0001 function ch_info = vb_info_get_channel_info(info, ch_type)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 if ~exist('info', 'var'), info = []; end
0027 if ~exist('ch_type', 'var'), ch_type = []; end
0028 [info, ch_type] = inner_check_arguments(info, ch_type);
0029
0030
0031
0032
0033 ch_info = [];
0034
0035 if ch_type == 0
0036 if isfield(info, 'ChannelInfo') && ~isempty(info.ChannelInfo)
0037 ch_info = info.ChannelInfo;
0038 end
0039 elseif ch_type == 1
0040 if isfield(info, 'ExtraChannelInfo') && ~isempty(info.ExtraChannelInfo)
0041 ex_info = info.ExtraChannelInfo;
0042 ch_info.Active = ex_info.Channel_active;
0043 ch_info.Name = ex_info.Channel_name;
0044 ch_info.Type = ex_info.Channel_type;
0045 ch_info.ID = ex_info.Channel_id;
0046 end
0047 elseif ch_type == 2
0048 if isfield(info, 'ChannelInfo') && ~isempty(info.ChannelInfo)
0049 ch_info = info.ChannelInfo;
0050 else
0051 ch_info.Active = [];
0052 ch_info.Name = {};
0053 ch_info.ID = [];
0054 ch_info.Type = [];
0055 end
0056 if isfield(info, 'ExtraChannelInfo') && ~isempty(info.ExtraChannelInfo)
0057 ex_info = info.ExtraChannelInfo;
0058 ch_info.Active = [ch_info.Active; ex_info.Channel_active];
0059 ch_info.Name = [ch_info.Name; ex_info.Channel_name];
0060 ch_info.Type = [ch_info.Type; ex_info.Channel_type];
0061 ch_info.ID = [ch_info.ID; ex_info.Channel_id];
0062 end
0063 else
0064 warning('(%s) unknown ch_type : %d\n', mfilename, ch_type);
0065 end
0066
0067 return;
0068
0069
0070
0071
0072
0073
0074
0075 function [info, ch_type] = inner_check_arguments(info, ch_type)
0076 func_ = mfilename;
0077 if isempty(info)
0078 error('(%s) info is a required parameter', func_);
0079 end
0080
0081 if isempty(ch_type)
0082 ch_type = 0;
0083 end
0084 return;
0085
0086
0087
0088
0089
0090