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
Information Type Frequently Asked Questions

Stay up-to-date with our dSPACE direct newsletter service.

With our dSPACE newsletter service, we will keep you informed about current use cases and new solutions and products, as well as trainings and events. Sign up here for a free subscription.

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.