<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992</link>
    <title>MATLAB Central Newsreader - if-statement with several commands in true case</title>
    <description>Feed for thread: if-statement with several commands in true case</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 06 Aug 2007 14:24:36 -0400</pubDate>
      <title>Re: if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386439</link>
      <author> DanK</author>
      <description>On Aug 6, 6:02 am, "Corinna Schmitt" &amp;lt;c...@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hallo,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I want to work with the if-case. If a variable has a&lt;br&gt;
&amp;gt; special value than a block of commands should be done. My&lt;br&gt;
&amp;gt; idea was:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; answer = input('Has your file this order? [Y/N] - ','s');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; if answer=='Y' (&lt;br&gt;
&amp;gt;     numberOfRowsPlusHeader = str2num(input('How many rows&lt;br&gt;
&amp;gt;               inclusiv header has your input-file? ','s'));&lt;br&gt;
&amp;gt;     numberOfRowsPlusHeader;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;     %verify by user: name of input&lt;br&gt;
&amp;gt;     source = input('Which file should be imported? ','s');&lt;br&gt;
&amp;gt;     source;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;     %number and names of varaiables in [] brackets&lt;br&gt;
&amp;gt;     %correponds to the header of&lt;br&gt;
&amp;gt;     %the AIDA-output file (=column names)&lt;br&gt;
&amp;gt;     %number of %s corresponds to the number of column of&lt;br&gt;
&amp;gt;     %the AIDA-output file&lt;br&gt;
&amp;gt;     [MchipsID, prim_sec, Name, Integral, Bkg, category,&lt;br&gt;
&amp;gt;     Label, Area, Integral_Bkg, Homogeneity, Saturated,&lt;br&gt;
&amp;gt;     Quality] = ...&lt;br&gt;
&amp;gt;     textread(source,'%s %s %s %s %s %s %s %s %s %s %s %&lt;br&gt;
&amp;gt;     s',numberOfRowsPlusHeader, 'delimiter', '\t');&lt;br&gt;
&amp;gt; )&lt;br&gt;
&amp;gt; elseif&lt;br&gt;
&amp;gt;     display('Reorder you file and start the program again!')&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I always receive the following error message:&lt;br&gt;
&amp;gt; ??? Error: File: aidaimportV5.m Line: 80 Column: 17&lt;br&gt;
&amp;gt; Expression or statement is incorrect--possibly unbalanced&lt;br&gt;
&amp;gt; (, {, or [.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Can anyone help me?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Corinna&lt;br&gt;
&lt;br&gt;
Corinna, There are a couple of problems.&lt;br&gt;
First, don't bother with the parenthesis around all of the commands.&lt;br&gt;
MatLab keys off of the " if else end" words, not parenthesis.  Second,&lt;br&gt;
your follow on:  You use elseif but don't have a condition.  I think&lt;br&gt;
you just want "else".&lt;br&gt;
&lt;br&gt;
HTH,&lt;br&gt;
Dan&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 12:57:58 -0400</pubDate>
      <title>Re: if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386419</link>
      <author>John D'Errico</author>
      <description>"us " &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &lt;br&gt;
&amp;lt;f970r7$j83$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; John D'Errico:&lt;br&gt;
&amp;gt; &amp;lt;SNIP unrelated OP...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; It might be legal syntax in some&lt;br&gt;
&amp;gt; &amp;gt; other language, but Matlab is not some&lt;br&gt;
&amp;gt; &amp;gt; other language...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; not at all, in fact, ML is a lifestyle...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
Or sometimes a religion. ;-)&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 12:57:56 -0400</pubDate>
      <title>Re: if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386418</link>
      <author>John D'Errico</author>
      <description>"us " &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &lt;br&gt;
&amp;lt;f970r7$j83$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; John D'Errico:&lt;br&gt;
&amp;gt; &amp;lt;SNIP unrelated OP...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; It might be legal syntax in some&lt;br&gt;
&amp;gt; &amp;gt; other language, but Matlab is not some&lt;br&gt;
&amp;gt; &amp;gt; other language...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; not at all, in fact, ML is a lifestyle...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
Or sometimes a religion. ;-)&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 11:31:51 -0400</pubDate>
      <title>Re: if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386405</link>
      <author>us</author>
      <description>John D'Errico:&lt;br&gt;
&amp;lt;SNIP unrelated OP...&lt;br&gt;
&lt;br&gt;
&amp;gt; It might be legal syntax in some&lt;br&gt;
&amp;gt; other language, but Matlab is not some&lt;br&gt;
&amp;gt; other language...&lt;br&gt;
&lt;br&gt;
not at all, in fact, ML is a lifestyle...&lt;br&gt;
&lt;br&gt;
us&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 10:43:00 -0400</pubDate>
      <title>Re: if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386397</link>
      <author>John D'Errico</author>
      <description>"Corinna Schmitt" &amp;lt;csc@mathworks.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;f96rk7$flf$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hallo,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I want to work with the if-case. If a variable has a &lt;br&gt;
&amp;gt; special value than a block of commands should be done. My &lt;br&gt;
&amp;gt; idea was:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; answer = input('Has your file this order? [Y/N] - ','s');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if answer=='Y' (&lt;br&gt;
&lt;br&gt;
(snipped)&lt;br&gt;
&lt;br&gt;
&amp;gt; )&lt;br&gt;
&amp;gt; elseif &lt;br&gt;
&amp;gt;     display('Reorder you file and start the program again!')&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I always receive the following error message:&lt;br&gt;
&amp;gt; ??? Error: File: aidaimportV5.m Line: 80 Column: 17&lt;br&gt;
&amp;gt; Expression or statement is incorrect--possibly unbalanced &lt;br&gt;
&amp;gt; (, {, or [.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anyone help me?&lt;br&gt;
&lt;br&gt;
I don't remember anywhere in the Matlab&lt;br&gt;
documentation where it says to use ( ) to&lt;br&gt;
wrap an if case.&lt;br&gt;
&lt;br&gt;
In fact, I wonder if it is even legal matlab&lt;br&gt;
syntax. It might be legal syntax in some&lt;br&gt;
other language, but Matlab is not some&lt;br&gt;
other language.&lt;br&gt;
&lt;br&gt;
John&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Mon, 06 Aug 2007 10:02:47 -0400</pubDate>
      <title>if-statement with several commands in true case</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/153992#386391</link>
      <author>Corinna Schmitt</author>
      <description>Hallo,&lt;br&gt;
&lt;br&gt;
I want to work with the if-case. If a variable has a &lt;br&gt;
special value than a block of commands should be done. My &lt;br&gt;
idea was:&lt;br&gt;
&lt;br&gt;
answer = input('Has your file this order? [Y/N] - ','s');&lt;br&gt;
&lt;br&gt;
if answer=='Y' (&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numberOfRowsPlusHeader = str2num(input('How many rows   &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;inclusiv header has your input-file? ','s'));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numberOfRowsPlusHeader;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%verify by user: name of input &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;source = input('Which file should be imported? ','s');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;source;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%number and names of varaiables in [] brackets    &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%correponds to the header of&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%the AIDA-output file (=column names)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%number of %s corresponds to the number of column of &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%the AIDA-output file &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[MchipsID, prim_sec, Name, Integral, Bkg, category,  &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Label, Area, Integral_Bkg, Homogeneity, Saturated, &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Quality] = ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;textread(source,'%s %s %s %s %s %s %s %s %s %s %s %&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s',numberOfRowsPlusHeader, 'delimiter', '\t');&lt;br&gt;
)&lt;br&gt;
elseif &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;display('Reorder you file and start the program again!')&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
I always receive the following error message:&lt;br&gt;
??? Error: File: aidaimportV5.m Line: 80 Column: 17&lt;br&gt;
Expression or statement is incorrect--possibly unbalanced &lt;br&gt;
(, {, or [.&lt;br&gt;
&lt;br&gt;
Can anyone help me?&lt;br&gt;
&lt;br&gt;
Corinna&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
