<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MATLAB Basics: &#8216;Switch case&#8217; vs. &#8216;If elseif&#8217;</title>
	<atom:link href="http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/</link>
	<description>Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.</description>
	<lastBuildDate>Fri, 10 Feb 2012 20:31:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: dhull</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2527</link>
		<dc:creator>dhull</dc:creator>
		<pubDate>Tue, 18 Jan 2011 16:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2527</guid>
		<description>While I do not understand your code, I am convinced that with a combination of IF THEN ELSE, SWITCH CASE, and other flow control in MATLAB that you do not need a GOTO.

Doug</description>
		<content:encoded><![CDATA[<p>While I do not understand your code, I am convinced that with a combination of IF THEN ELSE, SWITCH CASE, and other flow control in MATLAB that you do not need a GOTO.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nimisha Nidhi</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2526</link>
		<dc:creator>Nimisha Nidhi</dc:creator>
		<pubDate>Tue, 18 Jan 2011 13:45:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2526</guid>
		<description>Hi Doug,

I need a substitute for goto statement in Matlab. Is there anything like that?

More precisely, I need to code the following in Matlab:

&lt;pre&gt;
 1  if Positive_Sentiment&lt;0.169994 then node 2 else node 3
 2  class = Up
 3  if Positive_Sentiment&lt;0.171732 then node 4 else node 5
 4  class = Down
 5  if Negative_Sentiment&lt;0.021006 then node 6 else node 7
 6  class = Up
 7  if Negative_Sentiment&lt;0.02358 then node 8 else node 9
 8  class = Down
 9  if Negative_Sentiment&lt;0.0261051 then node 10 else node 11
10  class = Up
11  if Negative_Sentiment&lt;0.0296845 then node 12 else node 13
12  class = Down
13  class = Up
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Doug,</p>
<p>I need a substitute for goto statement in Matlab. Is there anything like that?</p>
<p>More precisely, I need to code the following in Matlab:</p>
<pre>
 1  if Positive_Sentiment&lt;0.169994 then node 2 else node 3
 2  class = Up
 3  if Positive_Sentiment&lt;0.171732 then node 4 else node 5
 4  class = Down
 5  if Negative_Sentiment&lt;0.021006 then node 6 else node 7
 6  class = Up
 7  if Negative_Sentiment&lt;0.02358 then node 8 else node 9
 8  class = Down
 9  if Negative_Sentiment&lt;0.0261051 then node 10 else node 11
10  class = Up
11  if Negative_Sentiment&lt;0.0296845 then node 12 else node 13
12  class = Down
13  class = Up
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Eddins</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2030</link>
		<dc:creator>Steve Eddins</dc:creator>
		<pubDate>Thu, 22 Apr 2010 21:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2030</guid>
		<description>Michael&#8212;That&#039;s an RGB triplet of floating-point values in the range [0,1].  [0,0,0] is black and [1,1,1] is white.</description>
		<content:encoded><![CDATA[<p>Michael&mdash;That&#8217;s an RGB triplet of floating-point values in the range [0,1].  [0,0,0] is black and [1,1,1] is white.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Claughton</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2028</link>
		<dc:creator>Michael Claughton</dc:creator>
		<pubDate>Thu, 22 Apr 2010 18:27:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2028</guid>
		<description>Thanks Steve.That makes alot of sense. I appreciate it, and the matlab community. 
For what its worth, I ended up creating a GUI with pop-up menus, to ensure my input was always going to be the same.
I do have another silly little question. I used the get command to see a list of properties of a text box, my interest being the background colour, and I noticed it was in the format [0.XXX,0.XXX,0.XXX]. Do you, or does anyone, know what format that is, and how it relates to HEX codes? Cheers.
PS - I am really starting to enjoy using matlab.</description>
		<content:encoded><![CDATA[<p>Thanks Steve.That makes alot of sense. I appreciate it, and the matlab community.<br />
For what its worth, I ended up creating a GUI with pop-up menus, to ensure my input was always going to be the same.<br />
I do have another silly little question. I used the get command to see a list of properties of a text box, my interest being the background colour, and I noticed it was in the format [0.XXX,0.XXX,0.XXX]. Do you, or does anyone, know what format that is, and how it relates to HEX codes? Cheers.<br />
PS &#8211; I am really starting to enjoy using matlab.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Eddins</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2025</link>
		<dc:creator>Steve Eddins</dc:creator>
		<pubDate>Thu, 22 Apr 2010 11:28:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2025</guid>
		<description>Michael&#8212;

&lt;pre&gt;
switch lower(str)
  case &#039;string1&#039; % enter all case strings in lower case
    do_this;
  case &#039;string2&#039;
    do_this;
  otherwise
    et_phone_home;
end

&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Michael&mdash;</p>
<pre>
switch lower(str)
  case 'string1' % enter all case strings in lower case
    do_this;
  case 'string2'
    do_this;
  otherwise
    et_phone_home;
end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Claughton</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2024</link>
		<dc:creator>Michael Claughton</dc:creator>
		<pubDate>Thu, 22 Apr 2010 03:59:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-2024</guid>
		<description>Doug, with switch, is there a way to implement ignore case? In a string compare, you would use strcmpi, which is fine if you were using an if else, using a switch, how would you implement it?
Thanks in advacnce,
 - Michael.</description>
		<content:encoded><![CDATA[<p>Doug, with switch, is there a way to implement ignore case? In a string compare, you would use strcmpi, which is fine if you were using an if else, using a switch, how would you implement it?<br />
Thanks in advacnce,<br />
 &#8211; Michael.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Stauf</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-746</link>
		<dc:creator>Rick Stauf</dc:creator>
		<pubDate>Tue, 29 Jul 2008 00:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-746</guid>
		<description>Never Mind, I found a more efficient way to do it. Instead of searching the time area I simply multiply the time by the delta time to acquire the index number in the array. Thanks for your web tutorials. They are very helpful.</description>
		<content:encoded><![CDATA[<p>Never Mind, I found a more efficient way to do it. Instead of searching the time area I simply multiply the time by the delta time to acquire the index number in the array. Thanks for your web tutorials. They are very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Stauf</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-745</link>
		<dc:creator>Rick Stauf</dc:creator>
		<pubDate>Mon, 28 Jul 2008 23:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-745</guid>
		<description>Doug,

I&#039;m looking for a GoTo function for Matlab. I have an efficient search routine that I like to use in a number of areas that requires GoTos. Is there anything like this in matlab procedures?

Thank you for your help,
Rick</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>I&#8217;m looking for a GoTo function for Matlab. I have an efficient search routine that I like to use in a number of areas that requires GoTos. Is there anything like this in matlab procedures?</p>
<p>Thank you for your help,<br />
Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-751</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Thu, 27 Mar 2008 13:32:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-751</guid>
		<description>Phillip,

You need this for your input statement:

n=input(&#039;Please input the figure:&#039;,&#039;s&#039;)

This interprets whatever is typed as a string.  Without that switch, MATLAB is taking what you type and interpreting it and thus looks for a function called &quot;triangle&quot; or whatever and does not find it.

Doug</description>
		<content:encoded><![CDATA[<p>Phillip,</p>
<p>You need this for your input statement:</p>
<p>n=input(&#8216;Please input the figure:&#8217;,'s&#8217;)</p>
<p>This interprets whatever is typed as a string.  Without that switch, MATLAB is taking what you type and interpreting it and thus looks for a function called &#8220;triangle&#8221; or whatever and does not find it.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phillip Diedrick</title>
		<link>http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-752</link>
		<dc:creator>Phillip Diedrick</dc:creator>
		<pubDate>Thu, 27 Mar 2008 11:08:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/01/02/matlab-basics-switch-case-vs-if-elseif/#comment-752</guid>
		<description>I want to use the switch/case for the following. I want to prompt the user to input one the following strings: triangle, square,pentagon or hexagon. Depending which figure you input the program will then calculate the sum of the interior angles of the figure using (n-2)(180). I tried the following and I&#039;m prompted with an error message. Here is my code.
clear;
clc;
n=input(&#039;Please input the figure:&#039;)
switch n
case (&#039;triangle&#039;)
n=3;
sum=(n-3).*(180)
case (&#039;square&#039;)
n=4;
sum=(n-3).*(180)
case(&#039;pentagon&#039;)
n=5;
sum=(n-3).*(180)
case (&#039;hexagon&#039;)
n=6;
sum=(n-3).*(180)
end
Please could you assist me.
Thanks</description>
		<content:encoded><![CDATA[<p>I want to use the switch/case for the following. I want to prompt the user to input one the following strings: triangle, square,pentagon or hexagon. Depending which figure you input the program will then calculate the sum of the interior angles of the figure using (n-2)(180). I tried the following and I&#8217;m prompted with an error message. Here is my code.<br />
clear;<br />
clc;<br />
n=input(&#8216;Please input the figure:&#8217;)<br />
switch n<br />
case (&#8216;triangle&#8217;)<br />
n=3;<br />
sum=(n-3).*(180)<br />
case (&#8216;square&#8217;)<br />
n=4;<br />
sum=(n-3).*(180)<br />
case(&#8216;pentagon&#8217;)<br />
n=5;<br />
sum=(n-3).*(180)<br />
case (&#8216;hexagon&#8217;)<br />
n=6;<br />
sum=(n-3).*(180)<br />
end<br />
Please could you assist me.<br />
Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

