Load data from *.mat file with mask

7 Ansichten (letzte 30 Tage)
Timo
Timo am 27 Mär. 2023
Kommentiert: Timo am 28 Mär. 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!

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 27 Mär. 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 Kommentar
Timo
Timo am 28 Mär. 2023
Thank you! I will check how that works.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by