Découvrez les nouveaux services mydSPACE : Gestion des licences, la nouvelle aide dSPACE et le chatbot dSPACE dédié à la documentation utilisateur. Vous trouverez davantage d'informations et d'aide sur notre page d'assistance dédiée. Lien En savoir plus et obtenir de l'aide

FAQ 510: ​​RTT : How to set up Infinite replay of MAT/MF4 Files​

Question

How to set up infinitely replay of mat and mf4 files with Real-Time Testing (RTT)? 

Solution

In Signal Editor, you can set a finite value from a property. However, you cannot set infinite. 
On the other hand, RTT can replay infinitely. 
The code below is a sample code that assigns the parameter values Signal1 defined in the MAT file to Constant1 of Model Root, respectively, and flows data at the cycle defined in Time.

Sample Code:

from rttllib import variable  
from rttllib import datastream  
 
# Create Variable objects  
Const1 = variable.Variable(r'Platform()://Model Root/Constant1/Value')  
 
# Create VariableToStimulate  
VariableToStimulate = datastream.CreateVariableMap("Time")  
 
VariableToStimulate.AddVariable("Signal_1", Const1)  
 
# Create MyStream  
MyStream = datastream.MatFile(r'(MAT file path)', VariableToStimulate)  
 
# Define MainGenerator  
def MainGenerator():  
    # Start Replay  
    yield MyStream.Replay()

 

The process of MAT/MF4 file replay in RTT is shown above. 
Up to line 14 is for settings such as which model variables to assign signals in the MAT file, and the actual playback instructions are in the last line. 
If you want to make an infinite loop in RTT, just change line 18 and after as follows.

while(True): 
    yield MyStream.Replay() 

 

A demo file of an RTT similar to this one can be found here.

C:\Users\user \Documents\dSPACE\Real-Time Testing\<dSPACE Release>\10_DataStreaming\RTTSequences\RTTSequence.py 
Limitation 
  • An RTT license is needed to do this. 
  • It is not possible to replay a mat or mf4 file infinitely in the Signal Editor.

Tags

Date 2026-10-30
Type d’information Foire Aux Questions (FAQ)

Restez informé grâce à notre service de newsletter dSPACE direct.

Grâce à notre service de newsletter dSPACE, nous vous tiendrons informé des cas d'utilisation actuels, des nouvelles solutions et des nouveaux produits, ainsi que des formations et des événements. Inscrivez-vous ici pour un abonnement gratuit.

Enable form call

At this point, an input form from Click Dimensions is integrated. This enables us to process your newsletter subscription. The form is currently hidden due to your privacy settings for our website.

External input form

By activating the input form, you consent to personal data being transmitted to Click Dimensions within the EU, in the USA, Canada or Australia. More on this in our privacy policy.