Discover the new mydSPACE services: License Management, the new dSPACE Help, and dSPACE Chatbot for User Documentation. Find more information and support on our dedicated support page. Learn more & get support

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
Informationstyp FAQ (Häufig gestellte Fragen)

Immer auf dem neuesten Stand mit unserem Newsletter-Service.

Mit unserem Newsletter-Service informieren wir Sie über aktuelle Anwendungsbeispiele, neue Lösungen und Produkte sowie über Schulungen und Veranstaltungen. Hier geht's zur Anmeldung.

Formularaufruf freigeben

An dieser Stelle ist ein Eingabeformular von Click Dimensions eingebunden. Dieses ermöglicht es uns Ihr Newsletter-Abonnement zu verarbeiten. Aktuell ist das Formular ausgeblendet aufgrund Ihrer Privatsphäre-Einstellung für unsere Website.

Externes Eingabeformular

Mit dem Aktivieren des Eingabeformulars erklären Sie sich damit einverstanden, dass personenbezogene Daten an Click Dimensions innerhalb der EU, in den USA, Kanada oder Australien übermittelt werden. Mehr dazu in unserer Datenschutzbestimmung.