title: Matlab quickest way to read data from the serial port
body: <p>I am reading data from the serial device, single fscanf returns a 1 line of data, which takes around 0.02 to 0.05 seconds to get. And this will be in for loop, since I will need to read couple thousand of lines, so it will take almost a minute to do that.</p>
  
  <pre><code>for ii = 1:n % n is number of lines to read
      tic
      data_set(1, ii) = fscanf(serial1);
      toc
  end
  </code></pre>
  
  <p>Is there a faster way to read data from the serial device, because a minute for couple thousand lines for me is way too slow.</p>
  
  <p>In the above example, single fscanf timed by tic toc takes inbetween 0.02 to 0.05 seconds. When I read around 2000 lines, it can take almost a minute.</p>