Mercurial > hg > camir-aes2014
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/MIRtoolbox1.3.2/MIRToolbox/isamir.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,56 @@ +function b = isamir(x,class) + +if isempty(x) || isnumeric(x) + b = 0; + return +end + +if iscell(x) + x = x{1}; +end + +if isa(x,class) + b = 1; + return +elseif ischar(x) && strcmpi(class,'miraudio') + b = 1; + return +elseif not(isa(x,'mirdesign')) + b = 0; + return +end + +type = get(x,'Type'); +if iscell(type) + type = type{1}; +end +types = lineage(type); +b = 0; +i = 0; +while not(b) && i<length(types) + i = i+1; + if strcmpi(types(i),class) + b = 1; + end +end + + +function types = lineage(class) +switch class + case {'miraudio','mirenvelope'} + parent = 'mirtemporal'; + case {'mirautocor','mircepstrum','mirchromagram','mirhisto',... + 'mirkeysom','mirkeystrength','mirmatrix','mirmfcc',... + 'mirscalar','mirsimatrix','mirspectrum',... + 'mirtemporal','mirtonalcentroid'} + parent = 'mirdata'; + otherwise + parent = ''; +end + +if isempty(parent) + types = {class}; +else + parents = lineage(parent); + types = {class parents{:}}; +end \ No newline at end of file