Effacer les filtres
Effacer les filtres

Load data from *.mat file with mask

2 vues (au cours des 30 derniers jours)
Timo
Timo le 27 Mar 2023
Commenté : Timo le 28 Mar 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!

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 27 Mar 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 commentaire
Timo
Timo le 28 Mar 2023
Thank you! I will check how that works.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by