Mercurial > hg > mauch-mirex-2010
annotate _segmentation/parts2csv.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function parts2csv(song, filename, varargin) |
matthiasm@8 | 2 if nargin > 2 && strcmp(varargin{1}, 'integrated') |
matthiasm@8 | 3 parts = song.integratedparts; |
matthiasm@8 | 4 else |
matthiasm@8 | 5 parts = song.parts; |
matthiasm@8 | 6 end |
matthiasm@8 | 7 |
matthiasm@8 | 8 beattimes = song.beattimes; |
matthiasm@8 | 9 % beattimes = [0; beattimes]; |
matthiasm@8 | 10 indices = []; |
matthiasm@8 | 11 levels = []; |
matthiasm@8 | 12 letters = {}; |
matthiasm@8 | 13 |
matthiasm@8 | 14 for iPart = 1:length(parts) |
matthiasm@8 | 15 for iInstance = 1:length(parts(iPart).indices) |
matthiasm@8 | 16 indices = [indices parts(iPart).indices(iInstance)]; |
matthiasm@8 | 17 levels = [levels parts(iPart).level]; |
matthiasm@8 | 18 letters = [letters parts(iPart).letter]; |
matthiasm@8 | 19 end |
matthiasm@8 | 20 end |
matthiasm@8 | 21 |
matthiasm@8 | 22 [sorted, sortind] = sort(indices); |
matthiasm@8 | 23 |
matthiasm@8 | 24 f = fopen(filename,'w'); |
matthiasm@8 | 25 |
matthiasm@8 | 26 for iSeg = 1:length(indices) |
matthiasm@8 | 27 fprintf(f,'%1.2f,%1.3f,"%s"\n',beattimes(sorted(iSeg)),levels(sortind(iSeg)),letters{sortind(iSeg)}); |
matthiasm@8 | 28 end |
matthiasm@8 | 29 |
matthiasm@8 | 30 fclose(f); |
matthiasm@8 | 31 |