title: Problems with writing on serial port in Matlab
body: <p>I'm using serial cable to write commands from matlab to a camera controlled by C code.
  The problem is- it sometimes works and sometimes doesn't.. and it's very frustrating.</p>
  
  <p>The code I use in Matlab is:</p>
  
  <pre><code>Serialport=serial('COM18');
  fopen(Serialport);
  %Serialport.Timeout = 10000;
  fwrite(Serialport,FileName); %Send File name to the camera
  </code></pre>
  
  <p>And it gets stuck in the <code>fwrite</code> function without any error. I tried to use <code>fprintf</code> instead and it still sometimes works and sometimes doesn't work.
  I tried different <code>timeout</code>'s and still it doesn't work..</p>
  
  <p>I have found nothing about it in the web.</p>