Pass mat file to matlab function block
显示 更早的评论
Dear community,
I created a subsystem with a mask to enter the name of a mat file (figure below).

In my subsystem, i have a matlab function (figure below)

The code in the matlab function is as follows:
function y = fcn(fname,u)
x = load(fname);
y = x.factor *u;
The simulation files are attached.
I used the string constant to pass the file name to the matlab function, but it not working.
I want my subsystem to be protected, so the user can't access the matlab function. The user can only provides the mat file name.
The main question is how to pass a mat file to matlab function block throw a mask. The real model is more complicated, this is just a simple demonstration.
Thank you, Amjad
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Subsystems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!