<?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: How To Make Your Own Simulink Block</title>
	<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/</link>
	<description>This blog is about Simulink.</description>
	<pubDate>Mon, 23 Nov 2009 01:18:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-857</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Tue, 22 Sep 2009 18:22:01 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-857</guid>
		<description>@Dave Lewis - The Sum block is a built-in block, and the parameters dialog is not created using the Mask Editor.  You can not currently control port placement, but this is a popular requested masking feature.

As far as plotting a circle, I would use SIN and COS to create the data points and then use the plot command to display them on the block icon.  There is a tech support solution that shows how this is done with a MATLAB figure &lt;a href="http://www.mathworks.com/support/solutions/en/data/1-15I2I/?solution=1-15I2I" rel="nofollow"&gt;here&lt;/a&gt;.  You could put the following code in the initialization commands:

&lt;pre style="font-size: 11pt;" class="code"&gt;th = 0:pi/50:2*pi;
xunit = cos(th);
yunit = sin(th);&lt;/pre&gt;

And the following in your icon drawing commands:

&lt;pre style="font-size: 11pt;" class="code"&gt;plot(xunit,yunit)&lt;/pre&gt;

Make sure your Icon units is set to Autoscaled.</description>
		<content:encoded><![CDATA[<p>@Dave Lewis - The Sum block is a built-in block, and the parameters dialog is not created using the Mask Editor.  You can not currently control port placement, but this is a popular requested masking feature.</p>
<p>As far as plotting a circle, I would use SIN and COS to create the data points and then use the plot command to display them on the block icon.  There is a tech support solution that shows how this is done with a MATLAB figure <a href="http://www.mathworks.com/support/solutions/en/data/1-15I2I/?solution=1-15I2I" rel="nofollow">here</a>.  You could put the following code in the initialization commands:</p>
<pre style="font-size: 11pt;" class="code">th = 0:pi/50:2*pi;
xunit = cos(th);
yunit = sin(th);</pre>
<p>And the following in your icon drawing commands:</p>
<pre style="font-size: 11pt;" class="code">plot(xunit,yunit)</pre>
<p>Make sure your Icon units is set to Autoscaled.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Lewis</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-856</link>
		<dc:creator>Dave Lewis</dc:creator>
		<pubDate>Mon, 21 Sep 2009 03:16:56 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-856</guid>
		<description>Hello;

I am looking at the "sum" block in the simulink math library and have two questions regarding the mask.

1) How do I control the port placement on the mask icon? Using the circle sum feature I notice that the second port enters through the bottom. How is this done?

2) What is the appropreat "plot ()" instruction to draw a circle or an elipse?

Any help will be most welcome.

Regards

David</description>
		<content:encoded><![CDATA[<p>Hello;</p>
<p>I am looking at the &#8220;sum&#8221; block in the simulink math library and have two questions regarding the mask.</p>
<p>1) How do I control the port placement on the mask icon? Using the circle sum feature I notice that the second port enters through the bottom. How is this done?</p>
<p>2) What is the appropreat &#8220;plot ()&#8221; instruction to draw a circle or an elipse?</p>
<p>Any help will be most welcome.</p>
<p>Regards</p>
<p>David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pankaj Misra</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-830</link>
		<dc:creator>Pankaj Misra</dc:creator>
		<pubDate>Mon, 24 Aug 2009 05:12:58 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-830</guid>
		<description>Hi seth,
I am a new user of Simulink. I want to use Switch for selecting two different parameters for different interval .for example i have 12 interval in which in "Odd interval" i want one parameter and in "Even interval" other parameter.But in switch block How to put this condition in "Threshold" which does not recognize U1 or U2 etc.Please suggest me.</description>
		<content:encoded><![CDATA[<p>Hi seth,<br />
I am a new user of Simulink. I want to use Switch for selecting two different parameters for different interval .for example i have 12 interval in which in &#8220;Odd interval&#8221; i want one parameter and in &#8220;Even interval&#8221; other parameter.But in switch block How to put this condition in &#8220;Threshold&#8221; which does not recognize U1 or U2 etc.Please suggest me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-757</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Thu, 21 May 2009 13:47:03 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-757</guid>
		<description>Guy,

Thanks for the tip.  Using your example I got this to work on my PC.  My problem now is trying to get the s-function to compile to an xPC.

Thanks,
Jay</description>
		<content:encoded><![CDATA[<p>Guy,</p>
<p>Thanks for the tip.  Using your example I got this to work on my PC.  My problem now is trying to get the s-function to compile to an xPC.</p>
<p>Thanks,<br />
Jay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guy Rouleau</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-745</link>
		<dc:creator>Guy Rouleau</dc:creator>
		<pubDate>Thu, 14 May 2009 00:19:16 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-745</guid>
		<description>@Jay and Wei,

You can look at an example I made where I use a level 2 s-function to dynamically set the color of a block based on the value of a signal:

http://www.mathworks.com/matlabcentral/fileexchange/23127

It uses a level 2 M-file S-function. Using get_param and set_param, you can configure a lot of things in a running model, including mask value. 

To begin, I suggest using get_param and the "objectparameters" property to see all available properties of block or model. Once you found what you are looking for, tune it using get_param.

It would also be possible to do that using an event listener... let me know if you would like to know more about event listener, I think it is another cool feature. 

Guy</description>
		<content:encoded><![CDATA[<p>@Jay and Wei,</p>
<p>You can look at an example I made where I use a level 2 s-function to dynamically set the color of a block based on the value of a signal:</p>
<p><a href="http://www.mathworks.com/matlabcentral/fileexchange/23127" rel="nofollow">http://www.mathworks.com/matlabcentral/fileexchange/23127</a></p>
<p>It uses a level 2 M-file S-function. Using get_param and set_param, you can configure a lot of things in a running model, including mask value. </p>
<p>To begin, I suggest using get_param and the &#8220;objectparameters&#8221; property to see all available properties of block or model. Once you found what you are looking for, tune it using get_param.</p>
<p>It would also be possible to do that using an event listener&#8230; let me know if you would like to know more about event listener, I think it is another cool feature. </p>
<p>Guy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-743</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Fri, 08 May 2009 16:08:10 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-743</guid>
		<description>Jay, How about use level 2 m s-function?</description>
		<content:encoded><![CDATA[<p>Jay, How about use level 2 m s-function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-742</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 01 May 2009 21:25:12 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-742</guid>
		<description>Seth,

Is there a way to access the value of an inport in a mask to either display it or be able to use it in logic in a callback?

Thanks,
Jay</description>
		<content:encoded><![CDATA[<p>Seth,</p>
<p>Is there a way to access the value of an inport in a mask to either display it or be able to use it in logic in a callback?</p>
<p>Thanks,<br />
Jay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-736</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 24 Apr 2009 12:58:42 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-736</guid>
		<description>Hi,

Is there a way to include a jpeg or even pdf image into the Mask Help box?
I tried it according to the Matlab help but it didn't work out for me.
My goal is to write the entire help text including several pictures in another program and just save it as jpeg or pdf file.

I highly appreciate any help!
Thank you already in advance.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Is there a way to include a jpeg or even pdf image into the Mask Help box?<br />
I tried it according to the Matlab help but it didn&#8217;t work out for me.<br />
My goal is to write the entire help text including several pictures in another program and just save it as jpeg or pdf file.</p>
<p>I highly appreciate any help!<br />
Thank you already in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-725</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Thu, 02 Apr 2009 20:32:55 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-725</guid>
		<description>Another option would be to add the image data to the block UserData.  I always put the user data in a structure, in case I want to include multiple variables.  At the command prompt:

s.im = imread('imagefile.jpg');
set_param(blk,'UserData',s)

Then, in the MaskInitialization

s = get_param(gcb,'UserData')

And, in the mask code you should be able to call:

image(s.im)</description>
		<content:encoded><![CDATA[<p>Another option would be to add the image data to the block UserData.  I always put the user data in a structure, in case I want to include multiple variables.  At the command prompt:</p>
<p>s.im = imread(&#8217;imagefile.jpg&#8217;);<br />
set_param(blk,&#8217;UserData&#8217;,s)</p>
<p>Then, in the MaskInitialization</p>
<p>s = get_param(gcb,&#8217;UserData&#8217;)</p>
<p>And, in the mask code you should be able to call:</p>
<p>image(s.im)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir</title>
		<link>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-724</link>
		<dc:creator>Amir</dc:creator>
		<pubDate>Wed, 01 Apr 2009 09:41:09 +0000</pubDate>
		<guid>http://blogs.mathworks.com/seth/2008/07/27/how-to-make-your-own-simulink-block/#comment-724</guid>
		<description>Thanks Seth. Worked Like a charm :)

Is there no way, you can permanently link it though? Somehow embed the image into the mask.</description>
		<content:encoded><![CDATA[<p>Thanks Seth. Worked Like a charm :)</p>
<p>Is there no way, you can permanently link it though? Somehow embed the image into the mask.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
