You are on page 1of 3

d=daq.

getDevices %obtenemos las caracteristicas del NI USB 6210

% d(1) %samplingRate=2000;

% numberofSamples=200; %nuemero de muestras

s.Rate = 200;% frecuencia de muestreo=Fs

%ai = s.inputSingleScan() %leemos las entradas de los canales analogicas a NI USB 6210

%m= fopen('event.Data','w');

%excelFileName= 'samplemalaga';

s.DurationInSeconds = 40;%definimos el tiempo de la adquisicion

ch=s.addAnalogInputChannel('coronado','ai0', 'Voltage');%

ch.Range=[-5 5];

ch.Name='CANAL C0'

ch.InputType='SingleEnded';%Ajustar en modo referenciado a masa (RSE)

s.NumberOfScans %Numero de exploraciones para la operacion cuando se inicia sesion

ch=s.addAnalogInputChannel('coronado','ai1', 'Voltage');

[data,timestamps,triggerTime] = s.startForeground();% startForeground %devuelve los datos de


varias exploraciones adquiridos en una matriz mxn, donde m nuemero de exploracionesy nu
numero de canales

%created:d\v6\myfiles\myai.m %created:d\v6\myfiles\myai.mat

%m= fopen('event.Data','w)

%lh = s.addlistener('DataAvailable', @getData);

lh = s.addlistener('DataAvailable',... @(src,event) plot(event.TimeStamps, event.Data));%


creamos un oyente

%Adquirir datos s.NotifyWhenDataAvailableExceeds = 200;

% frecuencia con la que el evento DataAvaialble se dispara s.startBackground();

% la adquision de datos se realiza en el fondo s.IsLogging % ans = true ;esta adquiriendo


datos,false=no adquiere dato %s.ScansAcquired %pause(5); s.wait() % m=
fopen('event.Data','w'); %s.IsContinuous = true;% signal analog %s.startBackground() %data =
getdata(ai); % comienza %s.stop; delete(lh); %fclose(m); % n = fopen('event.Data','r'); %
[data,count] = fread(n,[3,inf],'double');

s.IsNotifyWhenDataAvailableExceedsAuto = true; lh = s.addlistener('DataAvailable',


@stopWhenExceedOneV);%configurar nuevo oyente para procesar los datos entrantes
type('stopWhenExceedOneV.m') %lh=s.addlistener('DataAvailable',... % @(getData)
getData(src,event) );

%filename='event.Data' %save(filename) s.IsContinuous = true; %signal digital


s.startBackground() %s.ScansAcquired%Nmero de exploraciones obtenida durante la operacin
%while s.IsRunning %pause(0.01) %fprintf('While loop: Scans acquired = %d\n', s.ScansAcquired)
%end fprintf('Acquisition has terminated with %d scans acquired\n', s.ScansAcquired);
disp('Acquiring data...'); disp('Acquisition complete.'); title('BRAIN UNFV-FIEI-PER','color','red')
% n = fopen('event.Data','r'); %[data,count] = fread(n,[3,inf],'double') xlabel('Time (segundos)');
ylabel('Voltage') Stop = 1; uicontrol('style','pushbutton','String','start',... 'Callback','Stop = 0;');
delete(lh)

%axis([0 40 -5 5 ]) toc% empleamos tic-toc para calcular el timpo de adquision

%mkdir('SESIONES/prueba'); %addpath ( 'SESIONES /prueba / myfiles' ) %prueba= 'test.mat';


%save(prueba)

%[stat,struc] = fileattrib; %PathCurrent = struc.Name; % guardar figura en la carpeta

% guardar workspace en la carpeta

%set(ai,'SampleRate',SampleRate); %set(ai,'SamplesPerTrigger',duration*SampleRate);
%set(ai,'TriggerType','Manual'); %s.Rate = 8000; %s.DurationInSeconds = 1; %[ai,triggerTime] =
s.startForeground(); %plot(triggerTime,ai); % Update the title of the graph
%set(titleHandle,'String',['Discrete Fourier Transform Plot (fft),Number of callback function calls:
', num2str(count)]);
%%rtwintgt -install %rtwintgt -uninstall %rtwintgt -version %rtwho

%rtwintgt -setup installs the Real-Time Windows Target kernel on your system. It performs the
same operation as rtwintgt -install.

%rtwintgt -install installs the Real-Time Windows Target kernel on your system. It performs the
same operation as rtwintgt -setup. On Windows Vista and Windows 7 systems, rtwintgt
-install requires User Account Control (UAC) to be enabled.

%rtwintgt -uninstall removes the Real-Time Windows Target kernel from your system. On
Windows Vista and Windows 7 systems, rtwintgt -uninstall requires User Account Control (UAC)
to be enabled.

%rtwintgt -version displays the Real-Time Windows Target currently installed on your system

You might also like