Mercurial > hg > camir-ismir2012
diff toolboxes/MIRtoolbox1.3.2/MIRToolbox/isamir.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
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 Fri Aug 19 13:07:06 2016 +0200 @@ -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