<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Mask Initialization and Self-Modifying Blocks</title>
	<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/</link>
	<description>This blog is about Simulink.</description>
	<pubDate>Sun, 22 Nov 2009 23:19:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-764</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Wed, 27 May 2009 18:52:09 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-764</guid>
		<description>@Jens - In situations where blocks end up disconnected I usually suspect that initialization code is deleting lines or blocks or both. Try to write conditional code to only delete the block if it needs to be replaced. If this doesn't help, contact technical support and they may be able to help find the reason why.</description>
		<content:encoded><![CDATA[<p>@Jens - In situations where blocks end up disconnected I usually suspect that initialization code is deleting lines or blocks or both. Try to write conditional code to only delete the block if it needs to be replaced. If this doesn&#8217;t help, contact technical support and they may be able to help find the reason why.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-763</link>
		<dc:creator>Jens</dc:creator>
		<pubDate>Wed, 27 May 2009 09:52:44 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-763</guid>
		<description>I've created a simular subsystem. My problem is, that all connection lines are shifted, eyery time I open my modell or I want to simulate it. There are no connection to the Subsystem when I open it.
Any Idea?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve created a simular subsystem. My problem is, that all connection lines are shifted, eyery time I open my modell or I want to simulate it. There are no connection to the Subsystem when I open it.<br />
Any Idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-717</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Tue, 24 Mar 2009 01:29:27 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-717</guid>
		<description>@Hans - I suggest that you aim to do the minimum work required to update the mask.  Start by finding the existing inports:

s = find_system(gcb,'BlockType','Inport')

Then delete some number of ports if you have too many, or add ports if you have too few.  MaskInitialization code is called during many different operations.  Every time you start the simulation, your block should merely check that the state of the blocks inside it match the values of the parameters in the mask.  Update diagram can also happen DURING simulation (think, Pause and Restart).  If your code just deletes all the ports, this will not be allowed.  Good luck on making your mask.</description>
		<content:encoded><![CDATA[<p>@Hans - I suggest that you aim to do the minimum work required to update the mask.  Start by finding the existing inports:</p>
<p>s = find_system(gcb,&#8217;BlockType&#8217;,'Inport&#8217;)</p>
<p>Then delete some number of ports if you have too many, or add ports if you have too few.  MaskInitialization code is called during many different operations.  Every time you start the simulation, your block should merely check that the state of the blocks inside it match the values of the parameters in the mask.  Update diagram can also happen DURING simulation (think, Pause and Restart).  If your code just deletes all the ports, this will not be allowed.  Good luck on making your mask.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-683</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Wed, 11 Feb 2009 22:01:52 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-683</guid>
		<description>Seth, I'm reading your post on self modifying blocks with great interest. I'd like to create a subsystem with a variable number of inputs, but am a novice at programming in simulinkese. My subsystem contains a mux to which the inputs will be connected. My mask for the subsystem will prompt for the number of inputs. So, since the new number of inputs may be more or less than the current number, I'm guessing I should start by removing all input ports and connectors from the input ports. I'm not sure how to find them however. Then I guess I would create new input ports, and sequentially connect them to the mux. I think I know how to do that. Any help you can provide would be great.</description>
		<content:encoded><![CDATA[<p>Seth, I&#8217;m reading your post on self modifying blocks with great interest. I&#8217;d like to create a subsystem with a variable number of inputs, but am a novice at programming in simulinkese. My subsystem contains a mux to which the inputs will be connected. My mask for the subsystem will prompt for the number of inputs. So, since the new number of inputs may be more or less than the current number, I&#8217;m guessing I should start by removing all input ports and connectors from the input ports. I&#8217;m not sure how to find them however. Then I guess I would create new input ports, and sequentially connect them to the mux. I think I know how to do that. Any help you can provide would be great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-531</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Fri, 05 Sep 2008 01:35:43 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-531</guid>
		<description>@Quan - Thanks for the compliment!

@Jim - The two methods can be combined.  If you have large structural changes in your block algorithm, the configurable subsystem can be used to switch between them.  It may be even easier to simply delete one block and replace it with the other, and then wire the ports appropriately.</description>
		<content:encoded><![CDATA[<p>@Quan - Thanks for the compliment!</p>
<p>@Jim - The two methods can be combined.  If you have large structural changes in your block algorithm, the configurable subsystem can be used to switch between them.  It may be even easier to simply delete one block and replace it with the other, and then wire the ports appropriately.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-520</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 29 Aug 2008 14:36:29 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-520</guid>
		<description>I have used configurable subsystems in my library to provide a similar capability - one block provides multiple variations of basically the same functionality. The drawback with my approach is that the input ports are present whether they are used or not. It seems that this approach could provide similar functionality with a much cleaner finished model.

Can the two techniques be combined - i.e., can I update my configurable subsytems to remove unused inputs via self-modification without breaking all my existing models that use those blocks?</description>
		<content:encoded><![CDATA[<p>I have used configurable subsystems in my library to provide a similar capability - one block provides multiple variations of basically the same functionality. The drawback with my approach is that the input ports are present whether they are used or not. It seems that this approach could provide similar functionality with a much cleaner finished model.</p>
<p>Can the two techniques be combined - i.e., can I update my configurable subsytems to remove unused inputs via self-modification without breaking all my existing models that use those blocks?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quan</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-515</link>
		<dc:creator>Quan</dc:creator>
		<pubDate>Thu, 28 Aug 2008 23:50:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-515</guid>
		<description>Hi Seth,

Great graphics you got here.  I especially like the first one,  cool animated picture!  I"m not a big simulink user, but I like the way you presented your information.  Love the graphics.

Quan</description>
		<content:encoded><![CDATA[<p>Hi Seth,</p>
<p>Great graphics you got here.  I especially like the first one,  cool animated picture!  I&#8221;m not a big simulink user, but I like the way you presented your information.  Love the graphics.</p>
<p>Quan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-503</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Fri, 22 Aug 2008 12:45:41 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-503</guid>
		<description>@Kai - The initial value will be the last one you entered into the library block mask.  When you work in the mask editor, all your parameters are initialized to 0, or the first option in a popup list.  After you have completed designing the mask, close the mask editor, and while the library is still unlocked, set the value in the mask.  Save the library, and this is now your default value.  The next time you drag that block into your model, that initial value will be your parameter value.</description>
		<content:encoded><![CDATA[<p>@Kai - The initial value will be the last one you entered into the library block mask.  When you work in the mask editor, all your parameters are initialized to 0, or the first option in a popup list.  After you have completed designing the mask, close the mask editor, and while the library is still unlocked, set the value in the mask.  Save the library, and this is now your default value.  The next time you drag that block into your model, that initial value will be your parameter value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kai</title>
		<link>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-502</link>
		<dc:creator>Kai</dc:creator>
		<pubDate>Fri, 22 Aug 2008 12:18:10 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/08/21/mask-initialization-and-self-modifying-blocks/#comment-502</guid>
		<description>I wonder how it is possible to define initial values for the parameters in the mask. for example your values "1" and "-1" for the upper and lower limit. how do you do this? when i define a parameter as 'uplim = 1' in the initialization window of the mask editor it still remains 0 when starting the model.

TIA,
Kai</description>
		<content:encoded><![CDATA[<p>I wonder how it is possible to define initial values for the parameters in the mask. for example your values &#8220;1&#8243; and &#8220;-1&#8243; for the upper and lower limit. how do you do this? when i define a parameter as &#8216;uplim = 1&#8242; in the initialization window of the mask editor it still remains 0 when starting the model.</p>
<p>TIA,<br />
Kai</p>
]]></content:encoded>
	</item>
</channel>
</rss>
