필터 지우기
필터 지우기

Real-Time Processing with Matlab

조회 수: 30 (최근 30일)
Gavriel Aminov
Gavriel Aminov 2018년 5월 21일
댓글: Ameer Hamza 2018년 5월 22일
I have to build a MATLAB GUI that controls an instrument (Network Analyzer), gets it results in real-time and has to process some results without effecting the real-time regime of data collection. The processing includes building current preview image of the results and some manipulations like interpolation and fft.
The question is, how can I be sure that the processing will not effect the real-time budget of the instrument? Is there is a way to command Matlab not to wait for the results of processing if the instrument passes another piece of data in order to be able to collect all the data without omitting a part of it?
For example, if the Cycle of the arrival of data from the Network (NA) is T, the time of collection from the NA is Tc, and the time of Processing is Tp. How can I ensure that Matlab will be ready to collect the data every T time, no matter what is the Tp? Even if Tp<T-Tc, sometimes Matlab has its delays of processing, as it is not real-time program. What can be done to prevent the effect of such delays?
For addition, if Tp>T-Tc, how the processing can be commanded to be executed at the "background" without effecting the cycle of the collection?

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 21일
편집: Ameer Hamza 2018년 5월 21일
See timer(). You can set the timerFcn to run every T seconds. The timer will run in the background and every T seconds, the timer will run and perform the function specified by timerFcn property regardless of what is executing. You can read the data and store it in a variable in the callback function. For example
t = timer('ExecutionMode', 'fixedRate', 'Period', 2, 'TimerFcn', @receiveData)
start(t)
You can define a function receiveData and place it in MATLAB path. timer will execute it every 2 second.
  댓글 수: 2
Gavriel Aminov
Gavriel Aminov 2018년 5월 22일
Ameer, thank you for your answers.
Ameer Hamza
Ameer Hamza 2018년 5월 22일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Gavriel Aminov
Gavriel Aminov 2018년 5월 21일
Thanks for the tip! What about the next Note at the documentation?
The timer object is subject to the limitations of your hardware, operating system, and software. Avoid using timer objects for real-time applications.
  댓글 수: 4
Guillaume
Guillaume 2018년 5월 21일
I feel it's worth repeating: A hard real-time constraint cannot be guaranteed. Note that this is not matlab that cannot guarantee this, but your OS.
Gavriel Aminov
Gavriel Aminov 2018년 5월 22일
Guillaume, thank you.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by