Identify gaps between data in column structure, and , for differences bigger than a defined value, find start and end index of the two values
Mostrar comentarios más antiguos
Hi to everybody. The Question is rather confusing but i will explain it. I have a data structure(data_struct)with 100 trials organised in columns. Each trial has another structure within called Eye_Data.The first column in Eye_Data is the 'time'. The gaps between the values are usually 2 ms. Some are 4 ms. I am trying to identify the gaps bigger than 2 ms and plot them on a 2D graph. This is working ok. But if i am trying to plot on timeseries plot, i need to find the two values that have 4 ms between them, so i can declare the start and end of a timeseries event. Please help me in this matter. Thank you The simple code is shown below
%%DISPLAY BLINKS
data_struct = handles.data_struct;
Selected_Trials = handles.Selected_Trials;
for bli = data_struct(Selected_Trials).Eye_Data(:,1);
BLINK = diff(bli);
if BLINK>2;
axes(handles.MainWindow);
plot(BLINK,'-y');
else
str = sprintf('No Blinks on trial:%d',trial);
set(handles.text_display,'String',str);
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!