title: Hints for counting and assigning to variable
body: <p>I am tasked to create a script counting eruptions with <code>VEI &gt;=3</code> for each year. Then display on screen about the volcano name and date if <code>VEI &gt;=3</code> and save the yearly number of eruptions with <code>VEI &gt;=3</code>.</p>
  
  <p>Data is in an excel file. After loading the file, here is what my script wrote:</p>
  
  <pre><code>% read the data
  [volcname,volcVEI,starteruptyear,starteruptmonth] = textread(inFile,'%s %f %f     %f %*f %*f %*f %*f','headerlines',1,'delimiter',',');
  
  %theVEI is an index for all the VEI &gt;=3
  theVEI = find(volcVEI &gt;= 3)
  theYear = starteruptyear(theVEI);
  
  Yearvolc = unique(theYear);
  
  startyear = min(Yearvolc);
  endyear = max(Yearvolc);
  
  for i = theVEI
      %theVEI(year)
      % Using the index value defined by i, I pluck out 
      screenprint = sprintf('The volcano %s, erupted on year %g, the %g month, with an intensity of VEI     %g',volcname{i},starteruptyear(i),starteruptmonth(i),volcVEI(i));
      disp(screenprint)
  end
  </code></pre>
  
  <p>Example data: </p>
  
  <p><a href="https://i.imgur.com/jlB5aWS.png" rel="nofollow noreferrer"><img src="https://i.imgur.com/jlB5aWS.png" alt="image"></a></p>