0001 function [new_list,idx] = vb_util_omit_list(base_list, target_list)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 if ~exist('base_list', 'var'), base_list = []; end
0023 if ~exist('target_list', 'var'), target_list = []; end
0024 [base_list, target_list, mode] = ...
0025 inner_check_arguments(base_list, target_list);
0026
0027
0028
0029 idx = [];
0030 list_len = length(base_list);
0031 switch mode
0032 case 0
0033 new_list = cell(1);
0034 new_cnt = 1;
0035 for i_elm = 1:list_len
0036 if ~any(strcmp(base_list{i_elm}, target_list))
0037 idx = [idx;i_elm];
0038 new_list{new_cnt} = base_list{i_elm};
0039 new_cnt = new_cnt + 1;
0040 end
0041 end
0042
0043 case 1
0044 new_list = [];
0045 for i_elm = 1:list_len
0046 if ~any(base_list(i_elm) == target_list)
0047 idx = [idx;i_elm];
0048 new_list = [new_list; base_list(i_elm)];
0049 end
0050 end
0051 end
0052
0053 if ~isempty(new_list{1})
0054 new_list = vb_util_arrange_list(new_list);
0055 idx = vb_util_arrange_list(idx);
0056 else
0057 new_list = [];
0058 idx = [];
0059 end
0060 return;
0061
0062
0063
0064
0065
0066
0067
0068 function [base_list, target_list, mode] = ...
0069 inner_check_arguments(base_list, target_list)
0070 func_ = mfilename;
0071 if isempty(base_list)
0072 error('(%s)base_list is a required parameter', func_);
0073 end
0074
0075 if isempty(target_list)
0076 error('(%s)target_list is a required parameter', func_);
0077 end
0078
0079 if isnumeric(base_list) && isnumeric(target_list)
0080 mode = 1;
0081 elseif ~isnumeric(base_list) && ~isnumeric(target_list)
0082 mode = 0;
0083 else
0084 error('(%s)base_list and target_list are different type', func_);
0085 end
0086
0087 base_list = vb_util_arrange_list(base_list);
0088 target_list = vb_util_arrange_list(target_list);
0089 return;
0090
0091
0092
0093
0094
0095