Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
yzeyang

Junior Member
Registered:
Posts: 12
Reply with quote  #1 
Hi Jaewon,

In the "Signal type" menu, does "General Input" mean analog input? If so, are there objects or examples on how they are handled in the runtime script?

Another questions is regarding recording of analog inputs. The ML daq toolbox does provide several examples on analog inputs. I was wondering if there are existing solutions for recording analog/digital inputs with ML.

Many thanks in advance!

 
0
Jaewon

Administrator
Registered:
Posts: 716
Reply with quote  #2 
Yes, "General Input"s are analog input. The menu won't show you any other option. They are recorded and saved automatically when a trial starts and stops. You don't need to do anything for them.

If you need to access the data during trials, see the get_analog_data function.
ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/runtimefunctions.html#get_analog_data

If you script with the scene framework, digital inputs will be recorded based on a software timer at ~1 kHz. Otherwise, you can feed the digital inputs to analog channels and record them as General Input.
0
yzeyang

Junior Member
Registered:
Posts: 12
Reply with quote  #3 
Hi Jaewon,

Where will  "General Input" data be saved? Would they be recorded according to the "AI sample rate"?

I understand the workaround to feed digtal inputs to analog channels. Would you elaborate on how digital inputs are recorded, when you said "based on a software timer at ~1 kHz"?  Is a specific adapter/signal type required or is the saving synchronized with trial start/end? Similarly to my questions regarding analog inputs, where will the digital inputs be saved (if not treated as analog).

Many thanks
0
Edward

Administrator
Registered:
Posts: 245
Reply with quote  #4 
All trial data, including "General Input" data or digital input data, will be saved as either the .bhv2 (recommended, and set as default), .h5 or .mat file. They can later be read and analyzed with mlread() into matlab.
0
Jaewon

Administrator
Registered:
Posts: 716
Reply with quote  #5 
As for the location of the saved data (both analog and digital), read the data file with mlread() and see the "AnalogData" field. Internally ML always samples at 1 kHz, but the data will be saved at the rate you choose on the menu.

Most of cheap DAQ boards do not support digital input sampling, so ML samples digital signals based on the OS timer. It is not as precise as a hardware clock, but not bad. All you need to do is just to wire the input signals to the DAQ board and assign them on the I/O menu.
0
yzeyang

Junior Member
Registered:
Posts: 12
Reply with quote  #6 
Hi Jaewon and Edward,

Your answers are really helpful! Really appreciate your help.

Here is what I got it. Analog data were saved by default as long as assigned in signal types. And it seems that feeding digital signal to analog channel is more reliable workaround.

One additional question, if a "duration" of 1000 msec is specified for "get_analog_data()" at time t=t0, which segment of data is fetched: [t0-1000:t0] or [t0:t0+1000]?

Thanks



0
Jaewon

Administrator
Registered:
Posts: 716
Reply with quote  #7 
Of course, the former. You can't fetch the data that is not acquired yet.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.