user150: I want to use sensors on an Arduino to control values in a MATLAB program. What are my options for communicating?
I've used Processing to receive data sent via the serial cable, and that strategy has worked pretty well. Is there something similar I can do using MATLAB? I'm somewhat new to MATLAB, so gentle guidance would be great.
I'm not really looking for something like the ArduinoIO package -- I want to have separate computation executing on the Arduino and occasionally informing my MATLAB program (which will occasionally poll the serial line, I suppose).

user8: I don't know a whole lot about MATLAB, but I found some tutorials about reading and writing from the serial port:
s = serial('COM1');
fopen(s)
fprintf(s, 'Your serial data goes here')
out = fscanf(s)

out is now your received data, and you can do whatever you want with it.
To close:
fclose(s)
delete(s)
clear s

It is from Writing and Reading Data (MATLAB/ Data and File Management/ Serial Port Devices).
From your question I assume you know about the Arduino side of things (using Serial).

user11: MATLAB Support Package for Arduino (aka ArduinoIO Package) allows you to do it fairly easily.

Sample usage:
%-- connect to the board 
a = arduino('COM9')
%-- specify pin mode 
a.pinMode(4,'input');
a.pinMode(13,'output');
%-- digital i/o 
a.digitalRead(4) % read pin 4
a.digitalWrite(13,0) % write 0 to pin 13
%-- analog i/o 
a.analogRead(5) % read analog pin 5
a.analogWrite(9, 155) % write 155 to analog pin 9


150: <p>I want to use sensors on an Arduino to control values in a <a href="http://en.wikipedia.org/wiki/MATLAB" rel="noreferrer">MATLAB</a> program. What are my options for communicating?</p>

<p>I've used <a href="http://en.wikipedia.org/wiki/Processing_%28programming_language%29" rel="noreferrer">Processing</a> to receive data sent via the serial cable, and that strategy has worked pretty well. Is there something similar I can do using MATLAB? I'm somewhat new to MATLAB, so gentle guidance would be great.</p>

<p>I'm not really looking for something like the <a href="http://www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package" rel="noreferrer">ArduinoIO</a> package -- I want to have separate computation executing on the Arduino and occasionally informing my MATLAB program (which will occasionally poll the serial line, I suppose).</p>
 8: <p>I don't know a whole lot about MATLAB, but I found some tutorials about reading and writing from the serial port:</p>

<pre><code>s = serial('COM1');
fopen(s)
fprintf(s, 'Your serial data goes here')
out = fscanf(s)
</code></pre>

<p><code>out</code> is now your received data, and you can do whatever you want with it.</p>

<p>To close:</p>

<pre><code>fclose(s)
delete(s)
clear s
</code></pre>

<p>It is from <em><a href="http://www.mathworks.com/help/matlab/matlab_external/writing-and-reading-data.html" rel="nofollow">Writing and Reading Data</a></em> (<em>MATLAB</em>/ <em>Data and File Management</em>/ <em>Serial Port Devices</em>).</p>

<p>From your question I assume you know about the Arduino side of things (using <code>Serial</code>).</p>
 11: <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package">MATLAB Support Package for Arduino (aka ArduinoIO Package)</a> allows you to do it fairly easily.</p>

<blockquote>
  <p>Sample usage:</p>
  
  <p>%-- connect to the board </p>
  
  <p><code>a = arduino('COM9')</code></p>
  
  <p>%-- specify pin mode </p>
  
  <p><code>a.pinMode(4,'input');</code></p>
  
  <p><code>a.pinMode(13,'output');</code></p>
  
  <p>%-- digital i/o </p>
  
  <p><code>a.digitalRead(4) % read pin 4</code></p>
  
  <p><code>a.digitalWrite(13,0) % write 0 to pin 13</code></p>
  
  <p>%-- analog i/o </p>
  
  <p><code>a.analogRead(5) % read analog pin 5</code></p>
  
  <p><code>a.analogWrite(9, 155) % write 155 to analog pin 9</code></p>
</blockquote>
