get index of label corresponding to label_list indx = vb_get_label_index(label,label_list) label : label list (cell array) label_list : reference label list (cell array) if indx(n)==0, there is no corresponding name in 'label_list' otherwise, label{n} = label_list{indx(n)} 2008-3-18 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function indx = vb_get_label_index(label,label_list) 0002 % get index of label corresponding to label_list 0003 % indx = vb_get_label_index(label,label_list) 0004 % label : label list (cell array) 0005 % label_list : reference label list (cell array) 0006 % if indx(n)==0, there is no corresponding name in 'label_list' 0007 % otherwise, label{n} = label_list{indx(n)} 0008 % 0009 % 2008-3-18 Masa-aki Sato 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 0014 N = length(label); 0015 0016 indx = zeros(N,1); 0017 0018 for n=1:N 0019 j = strmatch(label{n},label_list,'exact'); 0020 if ~isempty(j), indx(n) = j(1); end; 0021 end