source: orbit/octave/AutoAnalyseIRCode/processLogicdataAudioJack.m @ 6aa182f

RawEEGRaw_EEG_PlotServoTab_Interfacepyramid
Last change on this file since 6aa182f was 6aa182f, checked in by AzureViolin <zhanghaotz@…>, 9 years ago

add octave script

  • Property mode set to 100644
File size: 1.3 KB
Line 
1function INNER = processLogicdataAudioJack (csvLogicdataFileName, irCodeName)
2%process one data at a time
3
4% Decode IR remote signal data collected by Salease or compatible logic
5% analyser, read .csv file and process with Octave.
6% by:AzureViolin azureviolin.com
7
8
9data=load(csvLogicdataFileName); %need to delete file header manually
10
11sizedata=size(data);
12%calculate the time period between two data points.
13X=data(2:end,1);
14X1=data(1:sizedata-1,1);
15DIFF=X-X1;%the time periods
16
17Y_outer=DIFF>1e-2;%logic array of outer IR code
18Index_outer=find(Y_outer);%index of outer IR code
19Z_outer=DIFF(Index_outer);%time period of outer IR code
20
21DIFF_inner=DIFF(Index_outer(2):Index_outer(3));% get the 2nd segment of difference of inner codes
22X_inner=X1(Index_outer(2):Index_outer(3)+1);% get the 2nd segment of inner codes
23Y_inner=(DIFF_inner>1e-4)&(DIFF_inner<1e-2);% filter, get index
24Z_inner=DIFF_inner(find(Y_inner));%time period of inner codes
25
26%last digit in INNER
27INNER_last_digit=X_inner(Index_outer(3)-Index_outer(2)+1)-X_inner(find(Y_inner)(end)+1);%get inner code HIGH
28
29
30%fprintf('found when segment length = %d \n minimum segment is \n', slength);
31%output
32INNER=floor(Z_inner*1e5)';
33%INNER=(abs(INNER-100)<10);
34
35%write file
36
37if (exist ("irCodeName", "var"))
38        save (irCodeName,'INNER');
39endif
40
41endfunction;
Note: See TracBrowser for help on using the repository browser.