Missing documentation for slrealtime.Instrument methods?

조회 수: 6(최근 30일)
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
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!

채택된 답변

Pablo Romero
Pablo Romero 2023년 1월 9일
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.

추가 답변(1개)

Marcel Schoch
Marcel Schoch 2022년 9월 16일
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';
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);
instrument.BufferData = true; % set buffered to true
% read out data:
datas = instrument.getBufferedData();
data = datas('path_to_signal:1');
Maybe this helps a bit.





Community Treasure Hunt

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

Start Hunting!

Translated by