annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/mircompute.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function varargout = mircompute(algo,varargin)
wolffd@0 2
wolffd@0 3 l = length(varargin{1}); % number of audio files.
wolffd@0 4 for i = 1:l
wolffd@0 5 % for each audio file
wolffd@0 6 v = varargin;
wolffd@0 7 for j = 1:length(v)
wolffd@0 8 % for each variable associated to that audio
wolffd@0 9 if isa(v{j},'mirdata')
wolffd@0 10 v{j} = get(v{j},'Data');
wolffd@0 11 end
wolffd@0 12 if iscell(v{j})
wolffd@0 13 v{j} = v{j}{i};
wolffd@0 14 end
wolffd@0 15 %if not(iscell(v{j}))
wolffd@0 16 % v{j} = {v{j}};
wolffd@0 17 %end
wolffd@0 18 end
wolffd@0 19 % final result for that audio
wolffd@0 20 for k = 1:length(v{1})
wolffd@0 21 % for each segment in that audio file
wolffd@0 22 vk = v;
wolffd@0 23 for j = 1:length(vk)
wolffd@0 24 if iscell(vk{j})
wolffd@0 25 vk{j} = vk{j}{k};
wolffd@0 26 end
wolffd@0 27 end
wolffd@0 28 if 1 %nargout == 1
wolffd@0 29 res = algo(vk{:});
wolffd@0 30 else %% used for miremotion, provokes bug else...
wolffd@0 31 [res res2 res3 res4] = algo(vk{:});
wolffd@0 32 end
wolffd@0 33 if iscell(res)
wolffd@0 34 lr = length(res);
wolffd@0 35 for j = 1:lr
wolffd@0 36 varargout{j}{i}{k} = res{j};
wolffd@0 37 end
wolffd@0 38 else
wolffd@0 39 varargout{1}{i}{k} = res;
wolffd@0 40 if nargout == 4
wolffd@0 41 varargout{2}{i}{k} = res2;
wolffd@0 42 varargout{3}{i}{k} = res3;
wolffd@0 43 varargout{4}{i}{k} = res4;
wolffd@0 44 end
wolffd@0 45 end
wolffd@0 46 end
wolffd@0 47 end