<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769</link>
    <title>MATLAB Central Newsreader - strange error message</title>
    <description>Feed for thread: strange error message</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by 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>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 14 Sep 2009 08:03:02 -0400</pubDate>
      <title>strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#679945</link>
      <author>stpatryck</author>
      <description>Hello Folks,&lt;br&gt;
&lt;br&gt;
I typed in these commands:&lt;br&gt;
&amp;gt;&amp;gt; t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;gt;&amp;gt; x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
&amp;gt;&amp;gt; surf(x,y,z)&lt;br&gt;
&lt;br&gt;
I got the following error message:&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; surf at 78&lt;br&gt;
Z must be a matrix, not a scalar or vector.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
What am I doing wrong???</description>
    </item>
    <item>
      <pubDate>Mon, 14 Sep 2009 08:22:02 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#679949</link>
      <author>James Tursa</author>
      <description>stpatryck &amp;lt;stpatryck@gmail.com&amp;gt; wrote in message &amp;lt;ec15a73f-76ad-4291-a568-b615d121e464@v36g2000yqv.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello Folks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I typed in these commands:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; surf(x,y,z)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I got the following error message:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; surf at 78&lt;br&gt;
&amp;gt; Z must be a matrix, not a scalar or vector.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What am I doing wrong???&lt;br&gt;
&lt;br&gt;
Amazingly enough, the error message means exactly what it says! Your x and y inputs to surf form a mesh, and z forms the height at each mesh point. i.e., each combination of an x element and a y element needs to have a z element. So if x is an n-vector and y is an m-vector, then Z needs to be a m-by-n matrix.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Fri, 18 Sep 2009 03:11:58 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#680992</link>
      <author>SaintPatrick</author>
      <description>On Sep 14, 4:22&#160;am, &quot;James Tursa&quot;&lt;br&gt;
&amp;lt;aclassyguy_with_a_k_not_...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; stpatryck &amp;lt;stpatr...@gmail.com&amp;gt; wrote in message &amp;lt;ec15a73f-76ad-4291-a568-b615d121e...@v36g2000yqv.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hello Folks,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I typed in these commands:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; surf(x,y,z)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I got the following error message:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using ==&amp;gt; surf at 78&lt;br&gt;
&amp;gt; &amp;gt; Z must be a matrix, not a scalar or vector.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; What am I doing wrong???&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Amazingly enough, the error message means exactly what it says! Your x and y inputs to surf form a mesh, and z forms the height at each mesh point. i.e., each combination of an x element and a y element needs to have a z element. So if x is an n-vector and y is an m-vector, then Z needs to be a m-by-n matrix.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; James Tursa&lt;br&gt;
&lt;br&gt;
I don't understand -- z shows up in the workspace as a matrix with the&lt;br&gt;
same dimensions as x and y.  Since t is a matrix, z = sin(t) should&lt;br&gt;
also be a matrix.</description>
    </item>
    <item>
      <pubDate>Fri, 18 Sep 2009 05:01:04 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#681002</link>
      <author>James Tursa</author>
      <description>SaintPatrick &amp;lt;patrickmyu@gmail.com&amp;gt; wrote in message &amp;lt;45341af6-364d-45e0-bcc2-3536c8ae52fe@g6g2000vbr.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I don't understand -- z shows up in the workspace as a matrix with the&lt;br&gt;
&amp;gt; same dimensions as x and y.  Since t is a matrix, z = sin(t) should&lt;br&gt;
&amp;gt; also be a matrix.&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;gt;&amp;gt; x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
&amp;gt;&amp;gt; whos&lt;br&gt;
&amp;nbsp;&amp;nbsp;Name      Size                    Bytes  Class&lt;br&gt;
&amp;nbsp;&amp;nbsp;s         1x629                    5032  double array&lt;br&gt;
&amp;nbsp;&amp;nbsp;t         1x629                    5032  double array&lt;br&gt;
&amp;nbsp;&amp;nbsp;x         1x629                    5032  double array&lt;br&gt;
&amp;nbsp;&amp;nbsp;y         1x629                    5032  double array&lt;br&gt;
&amp;nbsp;&amp;nbsp;z         1x629                    5032  double array&lt;br&gt;
&lt;br&gt;
So why do you think t and z should be matrices? Clearly t is a vector, and z is a vector also because it is sin of a vector.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Sun, 20 Sep 2009 21:49:31 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#681412</link>
      <author>stpatryck</author>
      <description>On Sep 18, 1:01&#160;am, &quot;James Tursa&quot;&lt;br&gt;
&amp;lt;aclassyguy_with_a_k_not_...@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; SaintPatrick &amp;lt;patrick...@gmail.com&amp;gt; wrote in message &amp;lt;45341af6-364d-45e0-bcc2-3536c8ae5...@g6g2000vbr.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I don't understand -- z shows up in the workspace as a matrix with the&lt;br&gt;
&amp;gt; &amp;gt; same dimensions as x and y. &#160;Since t is a matrix, z = sin(t) should&lt;br&gt;
&amp;gt; &amp;gt; also be a matrix.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; whos&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &#160; Name &#160; &#160; &#160;Size &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;Bytes &#160;Class&lt;br&gt;
&amp;gt; &#160; s &#160; &#160; &#160; &#160; 1x629 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;5032 &#160;double array&lt;br&gt;
&amp;gt; &#160; t &#160; &#160; &#160; &#160; 1x629 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;5032 &#160;double array&lt;br&gt;
&amp;gt; &#160; x &#160; &#160; &#160; &#160; 1x629 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;5032 &#160;double array&lt;br&gt;
&amp;gt; &#160; y &#160; &#160; &#160; &#160; 1x629 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;5032 &#160;double array&lt;br&gt;
&amp;gt; &#160; z &#160; &#160; &#160; &#160; 1x629 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;5032 &#160;double array&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So why do you think t and z should be matrices? Clearly t is a vector, and z is a vector also because it is sin of a vector.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; James Tursa&lt;br&gt;
&lt;br&gt;
Sorry, my bad, I meant &quot;vector&quot; instead of matrix.  I should have been&lt;br&gt;
more specific.  A  vector is a 1 x n or n x 1 matrix. (Feel free to&lt;br&gt;
correct me if I'm mistaken.)&lt;br&gt;
&lt;br&gt;
Nevertheless, all of the variables have the same dimensions, so why&lt;br&gt;
the error message?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
t=0:0.01:2*pi;s=t;&lt;br&gt;
&amp;nbsp;x=cos(t).*cos(s);y=cos(t).*sin(s);z=sin(t);&lt;br&gt;
surf(x,y,z)&lt;br&gt;
&lt;br&gt;
??? Error using ==&amp;gt; surf at 78&lt;br&gt;
Z must be a matrix, not a scalar or vector.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Patrick</description>
    </item>
    <item>
      <pubDate>Sun, 20 Sep 2009 22:04:01 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#681417</link>
      <author>Matt Fig</author>
      <description>stpatryck &amp;lt;stpatryck@gmail.com&amp;gt; wrote in message &amp;lt;02e88d83-1feb-&lt;br&gt;
&amp;gt; Nevertheless, all of the variables have the same dimensions, so why&lt;br&gt;
&amp;gt; the error message?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
You are not listening either to us or MATLAB.  The criteria is NOT that the variables have the same dimensions!  Is THAT what the error message says?  No.  Read it again, and read the doc for surf, there is an example in the documentation.  Copy and paste the example, then look at the output from whos.&lt;br&gt;
&lt;br&gt;
doc surf   % READ IT.</description>
    </item>
    <item>
      <pubDate>Fri, 16 Oct 2009 21:06:03 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#687676</link>
      <author>Tom </author>
      <description>&quot;Matt Fig&quot; &amp;lt;spamanon@yahoo.com&amp;gt; wrote in message &amp;lt;h968sh$evd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; stpatryck &amp;lt;stpatryck@gmail.com&amp;gt; wrote in message &amp;lt;02e88d83-1feb-&lt;br&gt;
&amp;gt; &amp;gt; Nevertheless, all of the variables have the same dimensions, so why&lt;br&gt;
&amp;gt; &amp;gt; the error message?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You are not listening either to us or MATLAB.  The criteria is NOT that the variables have the same dimensions!  Is THAT what the error message says?  No.  Read it again, and read the doc for surf, there is an example in the documentation.  Copy and paste the example, then look at the output from whos.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; doc surf   % READ IT.&lt;br&gt;
&lt;br&gt;
I'm surprised by the lack of empathy in these replies.  Isn't this a help forum?  Why scan and post answers to threads asking for help, but make the asker feel like an idiot with replies like &quot;READ IT&quot; or &quot;amazingly, just what it says!&quot;??   Clearly MATLAB isn't as easy as you make it out to be if there's a site devoted to answering questions about the product!!!&lt;br&gt;
&lt;br&gt;
It's unfortunate if you both were made to feel inferior during your formative education if you asked a question someone else perceived as remedial.  But get over it and show others who know less some courtesy.</description>
    </item>
    <item>
      <pubDate>Fri, 16 Oct 2009 23:10:30 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#687690</link>
      <author>dpb</author>
      <description>Tom wrote:&lt;br&gt;
&amp;gt; &quot;Matt Fig&quot; &amp;lt;spamanon@yahoo.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;h968sh$evd$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; stpatryck &amp;lt;stpatryck@gmail.com&amp;gt; wrote in message &amp;lt;02e88d83-1feb-&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Nevertheless, all of the variables have the same dimensions, so&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; why the error message?&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; You are not listening either to us or MATLAB.  The criteria is NOT&lt;br&gt;
&amp;gt;&amp;gt; that the variables have the same dimensions!  Is THAT what the&lt;br&gt;
&amp;gt;&amp;gt; error message says?  No.  Read it again, and read the doc for surf,&lt;br&gt;
&amp;gt;&amp;gt; there is an example in the documentation.  Copy and paste the&lt;br&gt;
&amp;gt;&amp;gt; example, then look at the output from whos.&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; doc surf   % READ IT.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'm surprised by the lack of empathy in these replies.  Isn't this a&lt;br&gt;
&amp;gt; help forum?  Why scan and post answers to threads asking for help,&lt;br&gt;
&amp;gt; but make the asker feel like an idiot with replies like &quot;READ IT&quot; or&lt;br&gt;
&amp;gt; &quot;amazingly, just what it says!&quot;??   Clearly MATLAB isn't as easy as&lt;br&gt;
&amp;gt; you make it out to be if there's a site devoted to answering&lt;br&gt;
&amp;gt; questions about the product!!!&lt;br&gt;
...&lt;br&gt;
Well, the very first response told OP _exactly_ what was wrong and &lt;br&gt;
included the needed dimensions.&lt;br&gt;
&lt;br&gt;
c.s-s.m culture is pretty much a &quot;help to learn&quot; mentality as opposed to &lt;br&gt;
force-feed.  It's expected the learner/asker will do their part, too, &lt;br&gt;
and there seems to be a certain lack here of following direction.&lt;br&gt;
&lt;br&gt;
OP--&lt;br&gt;
&lt;br&gt;
ML means a 2D array when it says &quot;matrix&quot; and explicitly notes that a &lt;br&gt;
vector isn't.  An [nx1] (or [1xn]) doesn't qualify, either even though &lt;br&gt;
there are 2-dimensions; it must be mxn of the vector size.&lt;br&gt;
&lt;br&gt;
see meshgrid&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Mon, 19 Oct 2009 16:55:19 -0400</pubDate>
      <title>Re: strange error message</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/260769#688160</link>
      <author>Matt Fig</author>
      <description>&quot;Tom &quot; &amp;lt;slustu7@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; I'm surprised by the lack of empathy in these replies.  Isn't this a help forum?  Why scan and post answers to threads asking for help, but make the asker feel like an idiot with replies like &quot;READ IT&quot; or &quot;amazingly, just what it says!&quot;??   Clearly MATLAB isn't as easy as you make it out to be if there's a site devoted to answering questions about the product!!!&lt;br&gt;
&lt;br&gt;
There is a difference between a lack of empathy and exasperation.  The OP was told exactly what the problem was, by other posters and MATLAB itself.  The fact that the OP wasn't getting this point is why I said, &quot;READ IT.&quot;  &lt;br&gt;
You see, this is emphasis is not derision.  When someone doesn't get something, you emphasize the important part for them.  </description>
    </item>
  </channel>
</rss>

