Receive Inputs into Simulink
显示 更早的评论
Hello all,
I have been tasked with finding a way to build my programming/simulink model in such a way that someone who doesn't know much about the project can run my model and test it. I've got two ideas in mind, but i'm not sure how to go about doing it.
- I'd like to have a matlab parameter set function in which the user can specify inputs. There would be math in this script as well, but the end goal is to use this function to create an organized parameter set to move values back and forth from the workspace.
- I'd like to have the user have a numerical input (basically just a block that is easy to click and edit) for each individual needed input on the simulink model. I am aware MATLAB can programatically transfer the numbers, but for this project I can't rely on that.
I welcome other suggestions, but I truly am just trying to have a very organized and pretty simulink model that can have all the values set in the model and transpose back and forth between the workspace. Please note the following conditions before replying.
- This is a government research project, meaning I cannot share the actual code. However, I could share example mockups of what i'm trying to do if needed.
- While I'd logically assume I'd be writing instructions on a separate document for someone to use, I have to assume that this program has to be simple enough to be used by a technician who's never used my program before (meaning I can assume they have some knowledge of programming, but don't know the in's and out's of my programming which I would prefer they didn't know anyways.)
回答(1 个)
Monika Jaskolka
2021-1-28
编辑:Monika Jaskolka
2021-1-28
0 个投票
Have you taken a look at FromWorkspace and ToWorkspace blocks? If you have the user create all the data in the Matlab workspace (or have a script that will create the data in the workspace), you just have to add in a FromWorkspace block with the same name into the Simulink model in order to be able to read the data into the model.
5 个评论
Mitch Lautigar
2021-1-28
Monika Jaskolka
2021-1-30
So from my understanding, you are asking for way for a user to directly provide input into the Simulink model file itself. If the user is editing the Simulink file, and is providing some "matlab parameter set function", would using a MATLAB Function block work? I'd suggest looking at the "User-Defined Functions" that are available in the Simulink block library.

Pat Gipper
2021-1-30
You could take Monika's suggestion one step further by using a "From Spreadsheet" block, which would allow your model users to generate the input as a lookup table from a named spreadsheet file and tab. The first column is time in units of seconds, and the second column is the value at the particular time. There are many options. The file could generate an input signal directly. Or the file could simply be used to control a switch that turns on/off particular signals generated within your model.
Mitch Lautigar
2021-3-19
Anuj
2025-3-10
Hey, how did you make the GUI? Did you use the in built app designer that Matlab offers? If so, how did you link the Simulink file with that?
Thanks
类别
在 帮助中心 和 File Exchange 中查找有关 Signal Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!