source: prextra/findilab.m @ 10

Last change on this file since 10 was 5, checked in by bduin, 14 years ago
File size: 908 bytes
Line 
1%FINDILAB find indices of examples having a given identifier
2%
3%   LABS=FINDILAB(A,NAME,VALUES)
4%
5% INPUT
6%    A        input dataset with ilab structure (see ENABLEILAB)
7%    NAME     name of identifier to search
8%    VALUES   value, a vector, or a cell array with identifier values
9%
10% OUTPUT
11%    IND      indices of examples containing identifier VALUES
12%
13% DESCRIPTION
14% FINDILAB returns indices of examples that contain any of specified
15% values.
16%
17% SEE ALSO
18% ENABLEILAB, REMOVEILAB, findilab, SETILAB, findilabLIST
19
20% $Id: findilab.m,v 1.1 2005/05/03 15:00:21 pavel Exp $
21
22function ind=findilab(a,name,values)
23   
24    isvalidilab(a,name);
25   
26    t=getilab(a,name);
27   
28    ind=[];
29   
30    if isnumeric(values)
31        for i=1:length(values)
32            ind=[ind; find(t==values(i))];
33        end
34    end
35    if iscell(values)
36        for i=1:length(values)
37            ind=[ind; find(t==values{i})];
38        end
39    end
40   
41    return
Note: See TracBrowser for help on using the repository browser.