Receive Inputs into Simulink

6 views (last 30 days)
Mitch Lautigar
Mitch Lautigar on 28 Jan 2021
Commented: Mitch Lautigar on 19 Mar 2021
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.
  1. 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.
  2. 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.
  1. 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.
  2. 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.)

Answers (1)

Monika Jaskolka
Monika Jaskolka on 28 Jan 2021
Edited: Monika Jaskolka on 28 Jan 2021
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.
  4 Comments
Pat Gipper
Pat Gipper on 30 Jan 2021
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
Mitch Lautigar on 19 Mar 2021
@Monika Jaskolka and @Pat Gipper Both your solutions are viable solutions and I appreciate your input. I ended up creating a mini-gui on my simulink file that allowed input as needed.

Sign in to comment.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!