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

U6 Matlab Streaming


  • Please log in to reply
1 reply to this topic

#1 spencer.chen

spencer.chen
  • Members
  • 1 posts

Posted 14 November 2013 - 08:54 PM

Hi, I'm new to LabJack and am encountering quite a few problems using the stock .NET Matlab examples. Hope that someone can help me out:

 

I'm running the u6_simplestream.m script, and these are the problems that I'm encountering:

 

1. Matlab crash on ljudObj.Close().

 

2. "Stream scan overlapped" error even if my settings were the same as LJStreamUD. In fact, I found these error would cease in Matlab at sampling rates about 1/2 of that in LJStreamUD.

 

3. I encounter System.AccessViolationException on the line that attempts to read data from the stream buffer:

 

UD Driver Version = 3.39
Actual Scan Rate = 100
Actual Sample Rate = 200
 
.NET Error: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
 
   at LabJack.LabJackUD.LJUD.UDeGet(Int32 handle, IO IOType, CHANNEL channel, Double& val, Double[] x1)
 
   at LabJack.LabJackUD.LJUD.eGet(Int32 handle, IO IOType, CHANNEL channel, Double& val, Double[] x1)
Error using u6_simplestream (line 125)
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source: LJUDDotNet
HelpLink: 
 
Any help much appreciated. I'm encountering these errors on 2 separate machines running 64bit Win7 with 64bit Matlab (R2012b) with diver version 3.39 and U6 firmware 1.39 (hardware version 2).

 

 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 15 November 2013 - 12:13 PM

1) You can remove the Close call. In most cases it is not needed, and the current driver has an issue with it if streaming was started. In a future update the Close calls will be removed from the examples.

 

2) Usually that indicates a sample rate that is too fast for the U6. What is the scan rate and the number of channels you are setting? The max sample rate (scan rate * number of channels) is about 50k samples/sec.

 

3) 64-bit versions of MATLAB may have issues like you are seeing when using eGet and arrays. Try using eGetPtr instead when reading stream data and see if that helps. That function was added in the last UD driver 1.39 release.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users