Allow user to create/modify block diagram

2 views (last 30 days)
Hi!
This may sounds quite strange, but I want to allowed the final user of my MATLAB application to be able to create, save and modify some block diagrams with a small set (about 10) of available blocks and some connection between them. Is it possible? How?
Thanks,
Jacopo
Details:
The application I have in mind is for impedance spectroscopy, and in this field, the modelling of proper electrical circuits is very important, so the user will have to place some simple blocks (i.e. resistors, capacitors, inductors, etc.) and connect them with a proper network.
The final application will have to be available as a stand-alone executable, so I don't know if the matlab runtime engine can support simulink (never used)

Accepted Answer

Mark McBroom
Mark McBroom on 12 Jan 2019
There is a multistep approach that most people take when trying to do this. It will not prohibit people from using other blocks.
  1. Create a custom library that is composed of only the blocks you want to allow.
  2. Add this new library to the library browser.
  3. Disable and hide other block libraries from the library browser.
  4. Create a Model Advisor script that checks a model and gives warnings/errors if prohibited blocks are used. This requires Simulink Check. If you don't have a license for Simulink Check, you can write a MATLAB script and have this script placed in one of the Model Callbacks so that the script runs when the user closes the model. Either way, the script would use the find_system() command to get a list of all blocks in the model and then compare that list against the list of allowed blocks.
  1 Comment
Jacopo Remondina
Jacopo Remondina on 15 Jan 2019
Dear Mark McBroom,
sorry if I took so much to reply, but I tried to implement your suggestion up to now (without success). As i wrote, I'm completly new to simulink, and what I'm trying to achieve is quite out of ordinary: I do NOT have to process a signal, but just get a model as a matlab variable, and I don't know how to obtain that. I tried to encapsulate the block objects inside a builtin signal (but the transmitted signal must be numeric), to construct a custom signal where to store the objects in a custom variable (but again, the blocks seems to transmit only the "DataType" property instead of the whole signal) and to recreate the network using the find_system and similar commands but without success.
Is there a way to obtain a list with all the links? Something like:
  • block A output is connected to block B input
  • block B output is connected to block C input
  • block B output is connected to block D input
where "block X" are the matlab objects with all the information/properties of the class?

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!