title: How to deal with error 'Undefined function 'times' for input arguments of type 'struct'.'
body: <p>A matlab program which was previously working for fine for about 6 months has starting giving the error </p>
  
  <p>'Undefined function 'times' for input arguments of type 'struct'.' The line where this appears is </p>
  
  <pre><code>sampleData.allDiameters= sampleData.allDiameters* pixelToMicron;
  </code></pre>
  
  <p>When I try methods such as a loop or saving as another variable from one of the structure fields it saves the new variable as a structure, which previously it did not do. Some examples of this:</p>
  
  <pre><code>for n=1:length(measurements)
      x=measurements(n); %saves x as 1x1 struct
      measurements(n)=x*pixelToMicron;
  end 
  
  %%%
  
  measurements=sampleData.allDiameters; %saves measurements as a 276x1 struct
  </code></pre>
  
  <p>This was triggered after a small loop was added which has since been deleted. This was a while loop and hadn't even been included in the main program. Nothing else was edited. For clarity this is the loop (as far as I got with it)</p>
  
  <pre><code>function [sampleData]=sphereCheck(sampleData)
  %for each object check how spherical each object is 
  
  %Measurement2: use regionprops to measure and record the x and y position
  %of the corner of the smallest box which bounds the object [xpos ypos xwidth       ywidth]
  measurements2=regionprops(sampleData.binImage, 'BoundingBox');
  sampleData.allDiameters
  
  
  counter=1
  while counter&lt;length(measurements2)
  %[~ ~ a b]=measurements2(counter);
  
  end 
  </code></pre>
  
  <p>I would like know how I can get the structures multiplying again or how I can access the data from the structure to perform operations on it.</p>