To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _chroma / sparsePrint.m @ 8:b5b38998ef3b
History | View | Annotate | Download (1.08 KB)
| 1 |
sizeMat = size(cosw); |
|---|---|
| 2 |
|
| 3 |
fid = fopen('/Users/matthiasmauch/Documents/_workspace/2010/2010-VampDevel-code/plugin-tutorial/coskernel-20-105-3-11025-4096-80.cpp','w');
|
| 4 |
|
| 5 |
fprintf(fid, 'const int lengthOfNoteIndex = %0.0f;\n\n', sum(cosw(:)>0)); |
| 6 |
|
| 7 |
fprintf(fid, 'const int nNote = %0.0f;\n\n', sizeMat(2)); |
| 8 |
|
| 9 |
fprintf(fid,'const int noteIndex[] = {')
|
| 10 |
|
| 11 |
for iCol = 1:sizeMat(2) |
| 12 |
for iRow = 1:sizeMat(1) |
| 13 |
if cosw(iRow,iCol) > 0 |
| 14 |
fprintf(fid, '%0.0f,',iCol-1); |
| 15 |
end |
| 16 |
end |
| 17 |
fprintf(fid,'\n'); |
| 18 |
end |
| 19 |
fprintf(fid,'};\n\n');transform |
| 20 |
|
| 21 |
% --------------------------- |
| 22 |
fprintf(fid,'const int fftBin[] = {')
|
| 23 |
|
| 24 |
for iCol = 1:sizeMat(2) |
| 25 |
for iRow = 1:sizeMat(1) |
| 26 |
if cosw(iRow,iCol) > 0 |
| 27 |
fprintf(fid, '%0.0f,',iRow-1); |
| 28 |
end |
| 29 |
end |
| 30 |
fprintf(fid,'\n'); |
| 31 |
end |
| 32 |
fprintf(fid,'};\n\n'); |
| 33 |
|
| 34 |
% --------------------------- |
| 35 |
fprintf(fid,'const double transfValue[] = {')
|
| 36 |
|
| 37 |
for iCol = 1:sizeMat(2) |
| 38 |
for iRow = 1:sizeMat(1) |
| 39 |
if cosw(iRow,iCol) > 0 |
| 40 |
fprintf(fid, '%0.5f,',cosw(iRow,iCol)); |
| 41 |
end |
| 42 |
end |
| 43 |
fprintf(fid,'\n'); |
| 44 |
end |
| 45 |
fprintf(fid,'};\n\n'); |
| 46 |
|
| 47 |
|
| 48 |
fclose(fid); |