Building Simulink Modell from Matlab Code

Hi there,
I am currently trying to build Simulink models from Matlab code and have some problems with.
My main problem is to figure out the names and/or path' of the blocks and their parameters. To find the block names I could find a workaround but I have no clue how to figure out the proper names of the parameters of one block. I would very appreciate if someone could tell me a function that returns the parameters or some workaround, so that I can change the parameters with
set_param('path to block','parameter name','parameter value')
Thank you very much!
Regards,
Lennart

3 Comments

I should probably be more precise: When talking about parameters I mean the parameters that are shown in the GUI when double clicking a Simulink block.
Can you explain with an example?

Sign in to comment.

 Accepted Answer

get_param('path to block','DialogParameters')

6 Comments

Lennart commented
Perfect! Thank you so much. Now I wonder why I didn't figure that out myself :/
Thank you so much! Any chance you have a good way to figure out the modules paths as well?
My current work around is as follows:
open_sysmte('simulink') navigate to the according block after clicking the block 'gcb' returns the according path.
is their a more simple way to get the path to a block?
Regards,
Lennart
The question is: to get the path from what? What is your input?
Lennart
Lennart on 8 Jul 2015
Edited: Lennart on 8 Jul 2015
There sure will be no function that I can give an input. I want to add blocks to my model using add_block(...), but when I brows through the library browser I can't find the path that the add_block - function requires.
For example I want to add an input port. I can find that in the library browser under Simulink -> Ports & Subsystems -> In1. When I want to add it using add_block. I will have to enter the path 'built-in/Inport'. The question is, how can I figure out that path, since I can't find it in the library browser.
Regards,
Lennart
I am not following you, each block is located somewhere in Simulink librairie
I don't know how else I should explain it. Just take the example. The path that you click with the mouse has nothing in common with the path that needs to be entered in the add_block-function. Of course every block is located somewhere in the Simulink library but how am I supposed to figure out where if the path that I take in the Simulink library browser is not what I have to enter in the add_block-function.
This for example is how I use the add_block-function to add an input port:
add_block('built-in/Inport',[opt.sys '/Signal' num2str(i)],'Position', pos);
Guess I will stick to my workaround then. Thank you for time and help!!!
If you have a liste of blocks that a user can choose. You can associate to each block a path. Just create another liste of path

Sign in to comment.

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!