Pass mat file to matlab function block
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Subsystems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!