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