extractfeatures.m

来自「* acousticfeatures.m: Matlab script to g」· M 代码 · 共 51 行

M
51
字号
function ret = extractfeatures(runname,nodes,type)
% Written by Marco F. Duarte 08/13/02
% Extracts event features from event timeseries
% ret: Return value (0 indicates normal, -1 indicates error)
% runname: Name of the run to be processed (i.e. 'aav3')
% nodes: vector with node numbers\

%run = 'aav3';
%nodes = [1 2 3 4 5 6 41 42 46 47 48 49 50 51 52 53 54 55 56 58 59 60 61];

Fs = 4960;
acfeat = [];
sefeat = [];

for i=nodes,
    j = 0;
    check = 0;
    while ~check,
        j = j + 1;
        checkb = 0;
        if exist(['output\' runname 'event' num2str(i) '_' num2str(j) '_1.txt']) == 2,
            eval(['load output\' runname 'event' num2str(i) '_' num2str(j) '_1.txt']);
            eval(['acts = ' runname 'event' num2str(i) '_' num2str(j) '_1;']);
            [F,FR] =  afm_mlpatternGen(acts,Fs,type);
            acfeat = [acfeat; FR];
            eval(['save output\' runname 'evfeat' num2str(i) '_' num2str(j) '_1.txt FR -ascii;']);
            checka = 0;
        else
            checka = 1;
        end
        if exist(['output\' runname 'event' num2str(i) '_' num2str(j) '_2.txt']) == 2,
            eval(['load output\' runname 'event' num2str(i) '_' num2str(j) '_2.txt']);
            eval(['sets = ' runname 'event' num2str(i) '_' num2str(j) '_2;']);
            [F,FR] =  sfm_mlpatternGen(sets,Fs,type);
            sefeat = [sefeat; FR];
            eval(['save output\' runname 'evfeat' num2str(i) '_' num2str(j) '_2.txt FR -ascii;']);
            checkb = 0;
        else
            checkb = 1;
        end
        check = checka & checkb;
    end
    disp(['Run ' runname ' Node ' num2str(i) ': ' num2str(j-1) ' events processed.']);
end
figure(1)
clf
imagesc(acfeat'), colormap(gray)
figure(2)
clf
imagesc(sefeat'), colormap(gray)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?