There are now several MATLAB packages for robotics, and specifically for the NXT. One paradigm is to run the code on a PC and have it communicate direct commands to the NXT Brick via Bluetooth or USB. I have found this paradigm to be a bit dangerous since in the event of a MATLAB crash or a miscommunication, the NXT Brick will continue with its last command until ordered to stop. This has the potential to destroy your robot. The paradigm that I prefer to use is to write several programs that run on the brick. These programs take commands from files on the brick that can be uploaded rapidly from the PC. The MATLAB code then is in charge of sending the command files and starting and stopping programs. In the event of a MATLAB crash or communication failure, the software running on the NXT Brick can be designed to terminate gracefully.
Here are the MATLAB packages that I know of. The first two are specifically geared toward the NXT; whereas the last is a general robotics package.
- LEGO MINDSTORMS NXT Toolkit for MATLAB and Simulink
- Robotics Toolbox for MATLAB (Release 7.1) (P.I. Corke)
- RWTH Mindstorms NXT Toolbox for Matlab