title: MATLAB: Error using * Inner matrix dimensions must agree
body: <p>So I'm working on a function that will receive inputs from from a user-defined structure to plot an ellipsoid, but Matlab keeps spitting out this error. Here's the portion I'm having trouble with:</p>
  
  <pre><code>theta = 0:(0.1):2*pi;
  phi = 0:(0.1):pi;
  a1 = ellipsoid_in(1).major_axis;
  b1 = ellipsoid_in(1).minor_axis;
  c1 = ellipsoid_in(1).transverse_axis;
  
  x1 = a1*sin(phi)*cos(theta);
  y1 = b1*sin(phi)*sin(theta);
  w1 = c1*cos(phi);
  plot3(x1,y1,w1)
  grid on
  hold on
  x2 = x1;
  y2 = y1;
  w2 = w1;
  plot3(x2,y2,z2)
  xx = [x1;x2];
  yy = [y1;y2];
  ww = [w1;w2];
  </code></pre>
  
  <p>The error is occurring in my first (x1) equation and I've already tried using the .* operator on them all with the same result. I'm guessing the problem is coming from the 1x2 structure I'm calling, but I don't know how to fix it. The variables for the structures all correspond to scalars. Any help is much appreciated.</p>