Home > vbmeg > functions > device > active_check > vb_get_label_index.m

vb_get_label_index

PURPOSE ^

get index of label corresponding to label_list

SYNOPSIS ^

function indx = vb_get_label_index(label,label_list)

DESCRIPTION ^

 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005