What is the latest Matlab equivalent of slrt SampleTime?

조회 수: 3 (최근 30일)
Jeffrey
Jeffrey 2023년 10월 23일
답변: Stefanie Schwarz 2023년 11월 17일
I have some code for an older version of Matlab, that creates a target object and grabs the sample time:
tg = slrt;
SampleTime = tg.SampleTime;
However, in the latest version of Matlab, the syntax should now be:
tg = slrealtime;
But I do not know how to get the sample time. What should the new syntax be? I have scoured Matlab documentation and am unable to find the answer.
  댓글 수: 3
Jeffrey
Jeffrey 2023년 10월 23일
I thought I could maybe use getparam, but I couldn't find the equivalent parameter. I also figured it would be in tg.ModelStatus, but I don't see it there either.
Jeffrey
Jeffrey 2023년 10월 23일
I might have to do something like this:
evalin('base', get_param(tg.ModelStatus.ModelName,"FixedStep"));
which is ugly.

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

답변 (1개)

Stefanie Schwarz
Stefanie Schwarz 2023년 11월 17일
You can use the target object "TETInfo" property:
>> tg = slrealtime;
>> tg.load('mymodel');
>> tg.ModelStatus.TETInfo
ans =
struct with fields:
Rate: 0.0100
Here is a cheat sheet for the API upgrade to SLRT R2020b and later:

카테고리

Help CenterFile Exchange에서 Target Computer Setup에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by