Mercurial > hg > c4dm-chord-transcriptions
comparison chordtools/checklabs.m @ 1:8973548174c1 tip
adding tools to repo
author | christopherh |
---|---|
date | Mon, 06 May 2013 14:43:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:0a4ad3e72e75 | 1:8973548174c1 |
---|---|
1 % | |
2 % CHECKLABS check chord syntax in all lab files in a directory | |
3 % | |
4 % success = checklabs(directory, logfile) | |
5 % | |
6 % Check the syntax of chord symbols in every lab file in the target | |
7 % directory. A log of syntax errors is created in the text file logfile | |
8 % | |
9 % Success = 1 if all symbols have correct syntax, 0 otherwise. | |
10 % | |
11 % returns: success (boolean) | |
12 % | |
13 % | |
14 % Author: Christopher Harte, March 2009 | |
15 % | |
16 % Copyright: Centre for Digital Music, Queen Mary University of London 2005 | |
17 % | |
18 % This file is part of the C4DM Chord Toolkit V2.0 | |
19 % | |
20 % The C4DM Chord Toolkit is free software; you can redistribute it and/or | |
21 % modify it under the terms of the GNU General Public License as published | |
22 % by the Free Software Foundation; either version 2 of the License, or | |
23 % (at your option) any later version. | |
24 % | |
25 % The C4DM Chord Toolkit is distributed in the hope that it will be useful, | |
26 % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
28 % GNU General Public License for more details. | |
29 % | |
30 % You should have received a copy of the GNU General Public License | |
31 % along with the C4DM Toolkit; if not, write to the Free Software | |
32 % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
33 | |
34 % | |
35 function [success] = checklabs(directory, logfile) | |
36 | |
37 files = dir([directory '/*.lab']); | |
38 | |
39 ilength = length(files); | |
40 | |
41 success = 1; | |
42 | |
43 fid = fopen(logfile, 'a'); | |
44 | |
45 for index = 1:ilength | |
46 | |
47 ok = checklabsyntax([directory '/' files(index).name],fid); | |
48 | |
49 success = success && ok; | |
50 | |
51 end | |
52 | |
53 fclose(fid); | |
54 |