Mercurial > hg > camir-aes2014
annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirdata/exportation.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 x = exportation(s) |
wolffd@0 | 2 |
wolffd@0 | 3 % EXPORTATION exports the peaks of a vectorial dimension |
wolffd@0 | 4 |
wolffd@0 | 5 v = get(s,'Data'); |
wolffd@0 | 6 n = get(s,'Name'); |
wolffd@0 | 7 pt = get(s,'PeakPosUnit'); |
wolffd@0 | 8 pp = get(s,'PeakPos'); |
wolffd@0 | 9 t = get(s,'Title'); |
wolffd@0 | 10 frames = 0; |
wolffd@0 | 11 for i = 1:length(v) |
wolffd@0 | 12 if iscell(v{i}) |
wolffd@0 | 13 v{i} = v{i}{1}; %% Segmented audio cannot be exported properly now. |
wolffd@0 | 14 end |
wolffd@0 | 15 if size(v{i},2) > 1 |
wolffd@0 | 16 frames = 1; |
wolffd@0 | 17 end |
wolffd@0 | 18 end |
wolffd@0 | 19 for i = 1:length(v) |
wolffd@0 | 20 if size(v{i},4) == 1 |
wolffd@0 | 21 vi = v{i}; |
wolffd@0 | 22 else |
wolffd@0 | 23 lvi = size(v{i},1); |
wolffd@0 | 24 vi = []; |
wolffd@0 | 25 for j = 1:size(v{i},4) |
wolffd@0 | 26 vi(lvi*(j-1)+1:lvi*j,:,:) = v{i}(:,:,:,1); |
wolffd@0 | 27 end |
wolffd@0 | 28 end |
wolffd@0 | 29 if i == 1 |
wolffd@0 | 30 x{1,1} = ['mean',t]; |
wolffd@0 | 31 x{1,2} = ['std',t]; |
wolffd@0 | 32 end |
wolffd@0 | 33 x{i+1,1} = mean(mean(vi)); |
wolffd@0 | 34 x{i+1,2} = mean(std(vi)); |
wolffd@0 | 35 pti = pt{i}; |
wolffd@0 | 36 ppi = pp{i}; |
wolffd@0 | 37 if not(isempty(ppi{1})) |
wolffd@0 | 38 if iscell(ppi{1}) |
wolffd@0 | 39 ppi = ppi{1}; %% Segmented audio cannot be exported properly now. |
wolffd@0 | 40 pti = pti{1}; |
wolffd@0 | 41 if iscell(pti{1}) |
wolffd@0 | 42 pti = ppi; |
wolffd@0 | 43 end |
wolffd@0 | 44 end |
wolffd@0 | 45 for j = 1:size(vi,2) |
wolffd@0 | 46 pep = ppi{1,j,1}; |
wolffd@0 | 47 if isempty(pep) |
wolffd@0 | 48 pet(j) = NaN; |
wolffd@0 | 49 pev(j) = NaN; |
wolffd@0 | 50 else |
wolffd@0 | 51 pet(j) = pti{1,j,1}(1); |
wolffd@0 | 52 if size(vi,3) > 1 && size(vi,1) == 1 |
wolffd@0 | 53 pev(j) = pep(1); |
wolffd@0 | 54 else |
wolffd@0 | 55 pev(j) = vi(pep(1),j,1); |
wolffd@0 | 56 end |
wolffd@0 | 57 end |
wolffd@0 | 58 end |
wolffd@0 | 59 if frames |
wolffd@0 | 60 if i == 1 |
wolffd@0 | 61 x{1,3} = ['meanpeakpos',t]; |
wolffd@0 | 62 x{1,4} = ['stdpeakpos',t]; |
wolffd@0 | 63 x{1,5} = ['meanpeakval',t]; |
wolffd@0 | 64 x{1,6} = ['stdpeakval',t]; |
wolffd@0 | 65 end |
wolffd@0 | 66 x{i+1,3} = mean(pet); |
wolffd@0 | 67 x{i+1,4} = std(pet); |
wolffd@0 | 68 x{i+1,5} = mean(pev); |
wolffd@0 | 69 x{i+1,6} = std(pev); |
wolffd@0 | 70 else |
wolffd@0 | 71 if i == 1 |
wolffd@0 | 72 x{1,3} = ['peakpos',t]; |
wolffd@0 | 73 x{1,4} = ['peakval',t]; |
wolffd@0 | 74 end |
wolffd@0 | 75 x{i+1,3} = pet; |
wolffd@0 | 76 x{i+1,4} = pev; |
wolffd@0 | 77 end |
wolffd@0 | 78 end |
wolffd@0 | 79 end |