필터 지우기
필터 지우기

Load data from *.mat file with mask

조회 수: 2 (최근 30일)
Timo
Timo 2023년 3월 27일
댓글: Timo 2023년 3월 28일
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!

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 3월 27일
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
Timo
Timo 2023년 3월 28일
Thank you! I will check how that works.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by