MATLAB is often used for post-test data analysis. You can get more value from your data acquisition session if you do the MATLAB analysis on the data as it is being collected. This can be done by having MATLAB be the software for collecting your data.

This video shows a very simple way of getting data into MATLAB from a DAQ board, in this case the windows soundcard.

Hi Doug, I have a question regarding DAT and usb mice, which doesn’t fit under either of your two previous posts.

I am trying to devise a cheap pendula experiment for university and highschool students,
the idea is to use a usb mouse (as has been done before, but differently and not using Matlab) as the sensor. I would like to use Matlab to acquire data from the usb mouse (specificaly the coordinates which would now be angles), but it should not be identified as a mouse, and should not interfere with the computers primary one.
I thought it might be possible to use DAT by creating an adaptor for the usb port, and then considering considering it as a digital input and not as a mouse.

As I have never used DAT before I am not sure this is possible, and if it is, exactly how to go about it.
Any help would therefore be very much apreciated!

Dayal, here’s another thought that could use the Data Acquisition Toolbox. Use a rotary potentiometer (variable resistor) as a sensor. The basic idea here is voltage divider. Place a reference voltage (say 5V) across the ends and connect the wiper pin to the analog input channel. The digitized voltage would be proportional to the rotation angle of the pot. Many cars now use exactly this for the gas pedal sensor, In fact, maybe you can take the foot pedal off a video game, or from a sewing machine, etc.

Hi Doug,
Is there a way to analyze the rpm of an engine from the sound with Matlab? I downloaded an example “Real time octave analysis” http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3076 and I tried to put in a band-pass filter but the program crashes every time when I try to run it.
If there is a way to do that, can you give me an idea how? For an 12 cylinder 4stroke engine and rpm between 800 – 9000 (16.67-150 Hz) it gives a maximum of 900 pulses a second. So I think I will need than a Fs > 1800 Hz. But is there a way to filter real time data ?

I can not speak to the stability of any of the File Exchange, you will need to speak to the original author about that. However, to filter “Real Time Data”, you need to be more specific. Are you tying to get the results of your analysis while the test is running, or is this post test analysis. If you want the results while the test is running, how “Real Time” do you need to be. You might end up using Real Time Workshop. Explain more what you are looking for, and I will try to help.

I’m trying to use an accelerometer to measure the tilt angle and record that data in MATLAB. I have it hooked up to a power supply and to a Measurement Computer USB-1208FS DAQ. Then I have code in MATLAB to acquire the data. It works for a second or two, but then it stops. Is there a template code for doing something like this? Any clue on the problem?

Hi all,
I have the Data Acquisition Toolbox, and I’m trying for 2 weeks to send a step voltage, and just after another one of a different voltage WITHOUT going back to “zero” between the two..
I tried to do it little by little and I saw that the “start” function between the two steps reinitialize the voltage at a value of zero volts. And I wouldn’t like it because the piezo I want to control has a really fast response time..

Furthermore I think I am compelled to use a “start” function between the two steps because I have to compute de Amplitude of the second step in real time so I don’t have to prepare the two steps before and put both of them in the engine using one “putdata”.

Is there a way to avoid it ?
Thank you a lot, This problem is really annoying me.

In Response to Post #10 by Bryan -
Hi Bryan,
By default the analog input object will acquire one second worth of data.
There are many ways to acquire more than that.
1. Set TriggerRepeat to greater than 0
2. Set SamplesPerTrigger to a larger number than the default, which matches the default SampleRate
3. Use either a TimerFcn or SamplesAcquiredFcn callback to restart the acquisition

Dear Sir,
I am working in a project that i use an Analogue to digital converter HW to transfer analogue electrical data to digital. I want to read this digital these data via Matlab using USB port in order to get its FFT. I would be very glad if you tell me how to do that. thanks alot for your help.
Gamal

Thank u Doug for ur fast reply. yes I have an NI-DAQ USB 6008. and I have an Analogue voltage sinusoidal signal that have a maximum frequency of 500KHz which means i want a minimum sampling of 1 Mhz. I want to analyze this signal using matlab( getting FFT) real time. can this be done by using the ADC in NI-DAQ or i have to get another ADC. if so how can i interface it with matlab. thanks alot Doug and I am waiting for your reply.
Gamal

The term “real time” means a lot of things to a lot of people. I am going to assume you mean “soft real time”, basically Windows is doing its best to keep up, but it might not be every clock cycle. If you are looking for hard real time, then you would want xPC.

Anyways, you could use a timer object to go through the above process every tenth of a second, query the data and so on. If you combine the ideas in this video with the ideas here:

Hey Doug, I was trying to obtain an output from my USB-6008. The output I was trying to get is suppose to be a voltage of for example 5V.
So, I used the following command but when I test my NI-DAQ analog output there was nothing and I did not understand why it is like that…

I am using interfacing hardware manufactured by Phidgets Inc.(http://www.phidgets.com). MATLAB has not yet developed an adaptor for it so I will have to make it myself.

I have to perform Real Time Data Acquisition and represent transitions in colors from Blue to Red when external pressure is applied on a Pressure Sensor which is connected to the interfacing hardware. The colors change in accordance with the magnitude of pressure applied.

How should I go about it and which toolboxes should I use in order to make this possible. Also, it would be Kind if you can let me know the various pdf resources I should definitely consult for same.

I am using an interfacing hardware manufactured by Phidgets Inc.(http://www.phidgets.com). MATLAB has not yet developed an adaptor for it so I will have to make it myself.

I have to perform Real Time Data Acquisition and represent transitions in colors from Blue to Red when external pressure is applied on a Pressure Sensor which is connected to the interfacing hardware. The colors change in accordance with the magnitude of pressure applied.

How should I go about it and which toolboxes should I use in order to make this possible. Also, it would be Kind if you can let me know the various pdf resources I should definitely consult for same.

I am using Phidget interfacing hardware manufactured by Phidgets Inc.(http://www.phidgets.com). MATLAB has not yet developed an adaptor for it so I will have to make it myself.

I have to perform Real Time Data Acquisition and represent transitions in colors from Blue to Red when external pressure is applied on a Pressure Sensor which is connected to the interfacing hardware. The colors change in accordance with the magnitude of pressure applied.

How should I go about it and which toolboxes should I use in order to make this possible. Also, it would be Kind if you can let me know the various pdf resources I should definitely consult for same.

I’m trying to do exactly what you did in your video, but have it display the sound in real time. For eg. to see the sound wave as you whistle. I’ve been having trouble trying find out how to do this or where to look for help.

Hi Doug, I am doing my final year project in which I need your help. My project is based on real time system(Level sensor). I have to control the level of the water in the tank using microcontroller and MATLAB. Till now I have already done the microcontroller part but, I am stuck with MATLAB GUI. I need your help to show the data in MATLAB GUI while the test is running. I have used ATMega32 microcontroller and ZigBee Transceiver Module. It’s kind of urgent to me…
Thanks…

hello
i have an ADAM 4000 card that is connected to computer serial port .how can i transfer data to matlab by this i/o card .if possible help me to have the driver and some useful cod
thank you
hassan

These postings are the author's and don't necessarily represent the opinions of MathWorks.