Projet

Général

Profil

script octave » transcode2.m

pgp pgp, 04/10/2019 15:51

 
%------------------------------------------------------------------------

Vmax=4.5;
Gain=24;
scale=10^6*Vmax/Gain/(2^23-1);
addpath=("~/signal/")
%------------------------------------------------------------------------

% Create a vector containing every Hexadecimal value in text format

clc
disp(['0 file(s) over ',num2str(N_files),' treated'])

for i_file=1:N_files

% Create a vector containing every Hexadecimal value in text format
filenumber=hex2dec(Start_index)+i_file-1;
filename=strcat('VS',DeviceNS,dec2hefilenumber,4),('.txt');
M=fread(fopen(fullfile(Date,strcat('C',DeviceN),filename)));

DataBuff=zeros(900000,1); % Create a vector for 1 file channel data

i=0;

for i1 = 1:47368
for i2=1:19
i=i+1;
ind=512*(i1-1)+26*(i2-1)+3*(Selected_Channel-1)+2;
buff=M(ind)*256^2+M(ind+1)*256+M(ind+2);
if buff > 8388607
buff = buff-2*8388608;
end
DataBuff(i,1) = single(buff) * scale;
end
end

Data((i_file-1)*899479+1:i_file*899479,1)=DataBuff(1:899479,1);

clc
disp([num2str(i_file),' file(s) over ',num2str(N_files),' treated'])
end
    (1-1/1)