title: Why am I getting 'output argument not assigned during call to' error in Matlab
body: <p>I have a function that Finds the Critical Points of a function.</p>
  
  <pre><code>function [ cr ] = CritPt(f, var1, var2)
  f = sym(f);
  fx = diff(f,var1);
  fy = diff(f,var2);
  [xcr,ycr] = solve(fx,fy);
  crpt = [xcr,ycr]
  </code></pre>
  
  <p>I am supposed to use the function CritPt in the Command Window to define a variable called cp which contains the critical points of f(x,y)=x^2*y+(1-y)^2</p>
  
  <p>When I attempt this I get:</p>
  
  <pre><code>&gt;&gt; cp=CritPt('x^2*y+(1-y)^2','x','y')
  
  crpt =
  
  [        0, 1]
  [  2^(1/2), 0]
  [ -2^(1/2), 0]
  
  Error in CritPt (line 2)
  f = sym(f);
  
  Output argument "cr" (and maybe others) not assigned
  during call to
  "C:\Users\GTAV\Documents\MATLAB\CritPt.m&gt;CritPt".
  </code></pre>
  
  <p>I have tried many alternatives like syms cp= [cp] = etc etc but there is clearly something I am not understanding. Any help would be greatly appreciated</p>