Hello,
I am trying to gather live data from the daq through matlab and I used the u3_simplestream example and added a live graph. However I would like to make the sample rate 1 per second so that the x axis is a time scale. However when I extend the pause to 2 pause(0.5) functions in the loop I get an error after 8 measurements.
Do you have a suggestion on how to change the sample rate and make it in terms of time?
Error Message:
UD Error: Buffer overrun while streaming. Stream stopped.
Error using u3_AIN0PIDstream (line 162)
Message: Exception of type 'LabJack.LabJackUD.LabJackUDException' was thrown.
Source: LJUDDotNet
HelpLink:
NetException with properties:
ExceptionObject: [1×1 LabJack.LabJackUD.LabJackUDException]
identifier: 'MATLAB:NET:CLRException:MethodInvoke'
message: 'Message: Exception of type 'LabJack.LabJackUD.LabJackUDException' was thrown.↵Source: LJUDDotNet↵HelpLink: '
cause: {}
stack: [1×1 struct]
Correction: []
UD Error: Buffer overrun while streaming. Stream stopped.
Error using u3_AIN0PIDstream (line 162)
Message: Exception of type 'LabJack.LabJackUD.LabJackUDException' was thrown.
Source: LJUDDotNet
HelpLink:
NetException with properties:
ExceptionObject: [1×1 LabJack.LabJackUD.LabJackUDException]
identifier: 'MATLAB:NET:CLRException:MethodInvoke'
message: 'Message: Exception of type 'LabJack.LabJackUD.LabJackUDException' was thrown.↵Source: LJUDDotNet↵HelpLink: '
cause: {}
stack: [1×1 struct]
Correction: []
Thanks!
That error indicates your application is not keeping up with the configured U3 hardware scan rate in stream mode, leading to buffer overflows.
Considering you want a low sample rate of 1 sample per second, try using command-response mode instead of stream mode for readings. It is easier to use, your software delays control the sample rate, and buffer overruns are not an issue. All non stream examples are using command-response mode for readings.
If you need the U3 hardware timing of stream mode for your samples, let me know and we can discuss it further.
I was able to more successfully set this up with the u3_simple sampling example. Thank you!!