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