Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Streaming mode in background in matlab

streaming u3 matlab

  • Please log in to reply
1 reply to this topic

#1 adran

adran
  • Members
  • 3 posts

Posted 27 March 2015 - 05:27 AM

Hi

 

I'd like to acquire a mixture of streaming and command/response data in matlab from a single u3.  Ideally I'd like to have the streaming acquisition running in the background so I don't need to interrupt execution of the main function to pull data off the DAQ.  Something like this: 

 

Function starts

 

- DAQ is initialised with 2 counters, 2 timers and some analogue + digital inputs

- Streaming starts

- Acquisition goes on for 1-2 hrs during which the counters are polled with command response occasionally when online data is needed in the function

- Streaming stops (and stream is saved)

 

end function

 

It seems from this post that it's possible to do command/response while streaming https://forums.labja...?showtopic=7046although I'd like to know if this might disrupt the continuity of the stream, and if it's possible to verify the continuity of the stream somehow. 

 

As for acquiring in the background, previously I've done this using NI DAQs in matlab where I was able to attach a callback to take data from the DAQ in the background everytime for example 1000 scans are available.  I'm trying to figure out if something similar is possible with the U3 and so far found LJ_swSLEEP which waits for a set number of scans to be available but disrupts execution so doesn't quite fit what I need. 

 

Any help much appreciated.

 

Adam



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 March 2015 - 11:56 AM

When stream mode is enabled you cannot read from the analog inputs or perform Read/Write/EraseMem calls, otherwise you can perform all other operations.

 

As for continuity, stream mode is high priority in the U3 hardware/firmware and command/response will not disrupt it. Both the U3 and the UD driver are checking for continuity errors, and if there is one you will get an error from the UD driver.

 

Instead of LJ_swSLEEP, look into using LJ_swALL_OR_NONE. It's non-blocking and either immediately returns the requested amount of scans or none if it is not all available yet. For all stream wait modes, refer to the stream pseudocode:

 

http://labjack.com/s...ers-guide/4.3.7





Also tagged with one or more of these keywords: streaming, u3, matlab

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users