Ok, lots of questions. I'll do my best.
How much time have your spent using MATLAB?
I've used it for systems control and data analysis daily for 4 years.
Do you have any experience working with MATLAB and other serial devices?
Yes, I've controlled Arduino and these products:
http://www.pololu.com/catalog/product/1350
http://www.4dsystems.com.au/prod.php?id=79
http://shop.tomsrc.com/product_info.php?cPath=103_154&products_id=645
Is this the first MATLAB/Maple program you are developing?
Yes.
Does your MATLAB code work on an Arduino?
Yes.
http://en.wikipedia.org/wiki/Finite-state_machine
The code is a MATLAB controlled virtual state machine, allowing time stamps for events with sub-millisecond precision unavailable without a real-time OS. Events logged are opening and closing of solenoid valves, LED on and off, timers / scheduled waves ending, sound onset and offset, and more generally, analog values crossing thresholds or digital lines going high or low. Although TCP/IP transmission adds a small amount of temporal jitter, the state machine can also send packets to an IP address on state entry. We use this to control a proprietary $60K odor delivery system that can combine any of 128 monomolecular odorants, and deliver the mixture in pulses accurate to 10ms. The rationale for using the state machine framework is for ease of session protocol development in psychophysics and neuroscience laboratories where neural data is acquired with respect to precisely controlled events.
An example of this system using $6,000 worth of computers and national instruments cards / cables / breakout boxes (+ a major headache to set up and maintain):
http://brodylab.princeton.edu/bcontrol/index.php/Main_Page
My goal is to create an open, comparable system for less than the cost of an ipod. (I call it project B-pod). It already works on Arduino Mega + ethernet shield - the only limitation is that Arduino takes 100 microseconds to sample an analog channel. Presently, our core setup uses 3 analog inputs (IR photogates) to trigger state changes on threshold crossing and 200us to execute state changes - so I'm still under 1ms. However, in our laboratory, we sometimes use more than 3 photogates and would like to use accelerometers / IMUs in the future to trigger state changes - so we'll need faster analog acquisition. Also, the benefit of 32 bit math will help shave time off state transitions, since all timestamps are long int and we're computing durations on-board to minimize write time over Serial.
Are you trying to communicate using SerialUSB() or SerialN()?
I've only used SerialUSB. I'll try SerialN.
"I agree that using LabVIEW and MATLAB are nice because these apps have mature GUIs."
Irrespective of GUI, we use MATLAB for ease of data analysis with the statistics libraries, and for ease of data handling (built-in matrix operations, etc). . . and also for historical reasons. Most science laboratories in the USA use Matlab for instrumentation, with Labview a close second - if you want to collaborate with other scientists on a project, you need a common language. Science would go nowhere if every collaboration started out with "Everything I've done is in Igor Pro, so you'll have to learn that first". Sadly, the scientific community's shelling point is very expensive, closed source, proprietary software. Rather than be an idealist, I'll stick with it for now, to maximize the benefit of open hardware in the hands of scientists. Encouraging them to learn a new language can come later. I'm thinking python.
Josh, is CTS/RTS still a problem for you?
Yes, I haven't found a workaround. Again, my error is:
>> fwrite(Ser, 'a')
??? Error using ==> serial.fwrite at 192
FWRITE cannot be called. The FlowControl property is set to 'hardware' and the Clear To Send (CTS) pin is high. This could indicate that the serial device may not be turned on, may not be connected, or does not use hardware handshaking.
Can help me with a current problem:?
I'm also waiting with baited breath for the micros() command to be implemented. Sadly, my area of expertise is Biology - it would take me months to get up to speed with Maple's toolchain under the hood so I can improve the source, so for now I'm just a user =(
Do you have any experience with these open source alternatives to MatLAB?
No, our lab is aware of them, Octave being the best contender - however, Octave does not have support for most of the "toolboxes" we use. (i.e. psychophysics toolbox, instrument control toolbox, statistics toolbox, image processing toolbox, etc.)
Finally, I'll re-iterate the bug I'm stuck on:
Matlab's Instrument Control Toolbox allows creation of a serial port object which can communicate with Arduino and the other hardware I listed above, but not Maple.
Thanks guys!
I'm excited to promote awareness and use of open hardware in the laboratory!
Josh Sanders
Kepecs Lab
Cold Spring Harbor Laboratory
http://kepecslab.cshl.edu/AK_research.html