How to plot a 16 channels graph

4 views (last 30 days)
Ken
Ken on 28 Oct 2012
Commented: Sarvesh Babu on 16 Feb 2018
Hi all,
I have a EEG .mat file which contains 16 channels of monopolar signals, I would like to know how i can plot it out to display all 16 channels. I tried plotting via the value that appear on workspace but it gave me a graph with all 16 channels mash together.
  7 Comments
javier coronado  bautista
javier coronado bautista on 24 Feb 2016
bueno ahí les dejo el código de adquisición de datos en tiempo real con el NI USB 6210 en matlab 2015b
javier coronado  bautista
javier coronado bautista on 24 Feb 2016
%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'); ch.Range=[-5 5]; ch.Name='CANAL C1' ch.InputType='SingleEnded';%Ajustar en modo referenciado a masa (RSE) ch=s.addAnalogInputChannel('coronado','ai2', 'Voltage'); ch.Range=[-5 5]; ch.Name='CANAL C2' ch.InputType='SingleEnded';%Ajustar en modo referenciado a masa (RSE) ch=s.addAnalogInputChannel('coronado','ai3', 'Voltage'); ch.Range=[-5 5]; ch.Name='CANAL C3' ch.InputType='SingleEnded';%Ajustar en modo referenciado a masa (RSE) %s.NumberOfScans %Numero de exploraciones para la operacion cuando se inicia sesion %s.addAnalogInputChannel('coronnel('coronado','ai7', 'Voltage'); %s.addAnalogInputChannel('coronado','ai8', 'Voltage'); %s.addAnalogInputChannel('coronado','ai9', 'Voltage') %s.NumberOfScans = 2000 %Número de exploraciones para la operación cuando se inicia [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 %ai = s.inputSingleScan() %leemos solo una exploracion de todos los 4 canales "C0,C1,C2,C3" de toda las exploraciones %Para adquirir varias exploraciones mediante operaciones temporizadas , véase % startForeground %d=daq.getDevices%obtenemos las caracteristicas del NI USB 6210 %d(1) %set(ai,'triggerFcn',{@mycalback,nado','ai4', 'Voltage'); %s.addAnalogInputChannel('coronado','ai5', 'Voltage'); %s.addAnalogInputChannel('coronado','ai6', 'Voltage'); %s.addAnalogInputCha %obj2mfile(ai,'myai.m'); %created:d\v6\myfiles\myai.m %created:d\v6\myfiles\myai.mat %m= fopen('event.Data','w'); %ch.InputType='SingleEnded'%Ajustar en modo referencia a masa| %Añadir un oyente con una llamada a la función anónima %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%Número de exploraciones obtenida durante la operación %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

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 28 Oct 2012
data=load ('sub1_export');
t=data.EEG_SAMPLE.time;
y=data.EEG_SAMPLE.signals.values;
out=reshape(y,16,[],1)
plot(t,out)
  7 Comments
Ken
Ken on 28 Oct 2012
icic, thanks a lot Azzi
Sarvesh Babu
Sarvesh Babu on 16 Feb 2018
Azzi what is t? Sorry to disturb you.

Sign in to comment.

More Answers (0)

Categories

Find more on Brain Computer Interfaces in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!