Load data from *.mat file with mask

8 visualizaciones (últimos 30 días)
Timo
Timo el 27 de Mzo. de 2023
Comentada: Timo el 28 de Mzo. de 2023
Hello,
I have a Simulink model with a subsystem with a mask.
The mask accepts a string value as input.
The subsystem then calls the "From File" block to load data into the Simulink workspace. When I hardcode the path in the "From File" block, it works as expected, but when I want to use the mask value like "InputFile" and then assign the "InputFile" mask parameter a string value with the path to the file which shall be loaded, the "From File" block only looks for "InputFile.mat", and not the file in the path of the mask parameter. That is very weird, as it is correctly assigning the path value when I look into the "From File" block properties. It finds the path and resolves the mask parameter, but still tries to load from "InputFile.mat".
How can I solve this?
Thank you in advance!

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 27 de Mzo. de 2023
For string parameters like folder and file name, you might not be able to pass it from the mask to the inside block parameter. Instead, I remember using a call-back of the masked string parameter. In the call-back, you use set_param() to set the file name of the "From File" block to be the value from the mask dialog.
  1 comentario
Timo
Timo el 28 de Mzo. de 2023
Thank you! I will check how that works.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by