forked from miditoolbox/1.1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perchannel.m
executable file
·37 lines (33 loc) · 1015 Bytes
/
perchannel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function chout = perchannel(nmat,func)
% Channel-by-channel analysis of notematrix using a specified function
% chout = perchannel(nmat,varargin);
% Channel-by-channel analysis of notematrix using a specified function.
% Works only with functions returning either scalar or row vector.
%
% Input argument:
% NMAT = notematrix
% FUNC = function (string)
%
% Output:
% chout = scalar or row vector for each channel. Size depends on the FUNC.
%
% Example:
% p=perchannel(nmat,'pcdist1');
%
% Change History :
% Date Time Prog Note
% 17.6.2002 20:03 TE Created under MATLAB 5.3 (PC)
%© Part of the MIDI Toolbox, Copyright © 2004, University of Jyvaskyla, Finland
% See License.txt
if isempty(nmat), return; end
if size(feval(func,createnmat),1)>1
disp([mfilename ' works only with functions returning either scalar or row vector!'])
chout=[];
return
end
chout =[];
for m=1:max(mchannels(nmat))
temp=getmidich(nmat,m);
chout(m,:) = [feval(func,temp)];
chout=[chout;];
end