comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirscalar/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 % SCALAR/EXPORTATION exports the values of a scalar object
4 % Filterbank not taken into consideration yet.
5
6 v = get(s,'Data');
7 t = get(s,'Title');
8 n = get(s,'Name');
9 pt = get(s,'PeakPosUnit');
10 pp = get(s,'PeakPos');
11 frames = 0;
12 for i = 1:length(v)
13 if iscell(v{i})
14 v{i} = v{i}{1}; %% Segmented audio cannot be exported properly now.
15 end
16 if iscell(v{i})
17 v{i} = v{i}{1};
18 end
19 if size(v{i},2) > 1 || size(v{i},3) > 1
20 frames = 1;
21 end
22 end
23 for i = 1:length(v)
24 vi = v{i};
25 pti = pt{i};
26 ppi = pp{i};
27 for j = 1:size(vi,1)
28 me = mean(vi(j,:,1),2);
29 if frames
30 st = std(vi(j,:,1),0,2);
31 if not(isempty(pti{1}))
32 if i == 1
33 if size(vi,1) > 1
34 x{1,j*4-3} = ['mean',t,num2str(j)];
35 x{1,j*4-2} = ['std',t,num2str(j)];
36 x{1,j*4-1} = ['peakpos',t,num2str(j)];
37 x{1,j*4} = ['peakval',t,num2str(j)];
38 else
39 x{1,j*4-3} = ['mean',t];
40 x{1,j*4-2} = ['std',t];
41 x{1,j*4-1} = ['peakpos',t];
42 x{1,j*4} = ['peakval',t];
43 end
44 end
45 pep = ppi{1,j,1}{1}; %% only first peak is taken
46 pet = pti{1,j,1}{1}; %% only first peak is taken
47 pev = vi(j,pep,1);
48 x{i+1,j*4-3} = me;
49 x{i+1,j*4-2} = st;
50 x{i+1,j*4-1} = pet;
51 x{i+1,j*4} = pev;
52 else
53 if i == 1
54 if size(vi,1) > 1
55 x{1,j*2-1} = ['mean',t,num2str(j)];
56 x{1,j*2} = ['std',t,num2str(j)];
57 else
58 x{1,j*2-1} = ['mean',t];
59 x{1,j*2} = ['std',t];
60 end
61 end
62 x{i+1,j*2-1} = me;
63 x{i+1,j*2} = st;
64 end
65 else
66 if i == 1
67 x{1,j} = t;
68 end
69 x{i+1,j} = me;
70 end
71 end
72 end