Comments on: How To Make Your Own Simulink Block https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/?s_tid=feedtopost Guy Rouleau is an Application Engineer for MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design. Tue, 20 Dec 2016 22:06:51 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: kami https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-160376 Fri, 19 Feb 2016 11:06:38 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-160376 Hi everyone

i made a Block with 2 Inputs, 3 Outputs and attached a GUI with this block so when user click the block, a GUI will apper. In the gui user can Change Block Parameters values and theses values are updated in the source code of the Subsystem block. Now i want to Display those updated block Parameters on the block so the user know whats inside.

Thanks in advance.

]]>
By: Krish https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-71943 Mon, 21 Jul 2014 18:35:22 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-71943 Hi there. Is it possible to have a rectangular subsystem (which is masked) to have ports on ALL four sides? How can we design that? Can the masked system be circular in shape? (like the round ADD block). Can we design polygons, with each side capable of taking input or giving output? Is it possible at least for electrical subsystems (where there is no direction)? Ex: a rectangular box with four electrical ports, one on each side. Thank you.

]]>
By: majida ahmed https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-64666 Sat, 26 Apr 2014 15:28:05 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-64666 hi i want to ask about fuzzy block always appear error message (undefined function or variable)with any block i built it and in any system block in different subject

]]>
By: Ray https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-39151 Sun, 28 Jul 2013 04:55:53 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-39151 Hello, I have between 3 to 36 simpowersys “Connection ports” to add dynamically. Please help! I have blocks which are initialized by a callback from mask but I don’t know who to create only the needed amount of Connection Ports. Thanks

]]>
By: Chandan https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-24629 Thu, 11 Apr 2013 10:14:50 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-24629 I have a masked subsystem. Based on masked parameters I draw its internals. Before drawing, I want to validate mask parameters. If they are invalid, I want to give an error (maybe in the form of error dialog box).

I am doing this in mask callback. I am giving error for invalid parameter value using errordlg. Error dialog pops up when invalid value is entered. But that invalid value is retained by the mask. If I press Ctrl+D to update the model, invalid value is propagated inside the drawing of subsystem.

How can I give error to avoid above problem?

]]>
By: aditya Mehta https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-1857 Wed, 13 Jun 2012 10:13:06 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-1857 Hi,
I want to have a mask subsystem which contains masked blocks.I should be able to set the properties of the masked block inside by setting the properties of parent subsytem.
Can you please help me on this.

]]>
By: PeyDian https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-1820 Sat, 05 May 2012 16:06:54 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-1820 i have some simple matlab code to describe the functionality of my project, and i wish to simulate my project through the simulink, how i do to create the block with only 1 input and 1 output?

]]>
By: Seth https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-1782 Mon, 09 Apr 2012 11:35:34 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-1782 @mandar – Any variable names you use as parameters must evaluate to variables in the MATLAB base workspace, the model workspace, or the mask workspace. Take a look at the post on hierarchical symbol resolution.

@Chandan – There can be many factors that affect the speed of simulation of the model. The mask code should only impact the initialization time. Try to isolate if the time is spent on initialization or simulation. To measure initialization try:

>> tic; set_param(bdroot,’SimulationCommand’,’Update’); toc

To measure the combined time of initialization and simulation, run:

>> tic; sim(bdroot); toc

Also, try reviewing the blog posts in the Performance Category.

]]>
By: Chandan https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-1781 Mon, 09 Apr 2012 11:07:55 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-1781 Hi,
I have created my own simulink blocks using masked subsystem.
The problem I am facing is simulation speed of the model. Whenever I update or simulate the model, it takes lot of time.

The mask initialization commands instantiates some primitive s-function blocks or some of my other subsystems, set their parameters and connects them.

How can I minimize simulation time?

]]>
By: mandar https://blogs.mathworks.com/simulink/2008/07/27/how-to-make-your-own-simulink-block/#comment-1746 Tue, 06 Mar 2012 09:12:53 +0000 https://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-1746 Hi Guy,
I wanted to create a block in simulink a Parameter A whose value can be changed as per requirement. When try to edit a constant block available in sources which has value 1 to a alphabet say b i get error that it is an invalid choice. please help.

]]>