comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/isamir.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function b = isamir(x,class)
2
3 if isempty(x) || isnumeric(x)
4 b = 0;
5 return
6 end
7
8 if iscell(x)
9 x = x{1};
10 end
11
12 if isa(x,class)
13 b = 1;
14 return
15 elseif ischar(x) && strcmpi(class,'miraudio')
16 b = 1;
17 return
18 elseif not(isa(x,'mirdesign'))
19 b = 0;
20 return
21 end
22
23 type = get(x,'Type');
24 if iscell(type)
25 type = type{1};
26 end
27 types = lineage(type);
28 b = 0;
29 i = 0;
30 while not(b) && i<length(types)
31 i = i+1;
32 if strcmpi(types(i),class)
33 b = 1;
34 end
35 end
36
37
38 function types = lineage(class)
39 switch class
40 case {'miraudio','mirenvelope'}
41 parent = 'mirtemporal';
42 case {'mirautocor','mircepstrum','mirchromagram','mirhisto',...
43 'mirkeysom','mirkeystrength','mirmatrix','mirmfcc',...
44 'mirscalar','mirsimatrix','mirspectrum',...
45 'mirtemporal','mirtonalcentroid'}
46 parent = 'mirdata';
47 otherwise
48 parent = '';
49 end
50
51 if isempty(parent)
52 types = {class};
53 else
54 parents = lineage(parent);
55 types = {class parents{:}};
56 end