Missing documentation for slrealtime.Instrument methods?

2 views (last 30 days)
Hello,
I'm trying to evaluate a setup for real time testing. I've found useful information on this link, where it is shown how to leverage python scripting to run a slrealtime application and get the acquired signals from the real time HW.
The script runs fine, but in an attempt to extend it for our purposes, I'm struggling to find some documentation on some of the methods used in such script. For example:
instrument.getBufferedData % no doc for getBufferedData method
and:
instrument.BufferData=true % no docs for BufferData property
The purpose is to be able to get signal values in real time in order to take actions during the execution of a test case.
Thanks in advance for any help!
Leonardo

Accepted Answer

Pablo Romero
Pablo Romero on 9 Jan 2023
You can find more information about the getBufferedData method and the BufferData property at Gets data from the real-time application instrument buffer - MATLAB getBufferedData (mathworks.com).
Please notice that the main purpose of the buffered data mode is providing support for external languages via the MATLAB Engine API that do not support callbacks. Using buffered data mode is not strictly required when manipulatin real-time data within MATLAB.
  3 Comments
Hui Xiao
Hui Xiao on 8 Sep 2023
slrealtime.Instrument object don't have a public propertiey BufferedData, so I am still confused on how to enable the buffered data mode.
Stefanie Schwarz
Stefanie Schwarz on 25 Oct 2023
Hi Hui, there is a typo in the 'getBufferedData' our documentation. It should be:
Instrument.BufferData = true;
('BufferData', not 'BufferedData').
We apologize for this and will fix the typo in the future MATLAB documentation.

Sign in to comment.

More Answers (1)

Marcel Schoch
Marcel Schoch on 16 Sep 2022
I have not found any documentation neither, but after having played around with the various options to get data in realtime, I've noticed the following:
Getting realtime data with the callback method
I've made somewhat mixed experience with using a callback method, especially in an app, it consumed a lot of resources and the callback is called very irregularely. It also made my application very slow, because it is called multiple times per second, and there does not seem to be any control over the call frequency.
instrument = slrealtime.Instrument('path_to_model.mldatx');
instrument.addSignal(path, 1);
inst.connectCallback(@(o,e)thisisacallback(o,e)); % adding a callback method
instrument.AxesTimeSpan = 10;
instrument.AxesTimeSpanOverrun = 'wrap';
tg.addInstrument(instrument);
Getting realtime data with getBufferedData
The following code works very well, instrument.getBufferedData() and datas(...) takes only very little time to execute. I prefer this solution as I have control over when data is read out.
instrument = slrealtime.Instrument('path_to_model.mldatx');
instrument.addSignal('path_to_signal', 1);
tg.addInstrument(instrument);
instrument.BufferData = true; % set buffered to true
% read out data:
datas = instrument.getBufferedData();
data = datas('path_to_signal:1');
Maybe this helps a bit.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!