Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog output problem using Matlab with USB 6009

 

Hi,

I am an undegraduate and tried accomplish my Project .

 

Actually, I just started my initial part that confirm my laptop can detect the input and output data through the NI-USB 6009.

When the analog signal reaches a value , then I want send the data out.

BUT I have some problems trying to generate a anolog output code  using MATLAB software only (have no LabVIEW).

 Can you give suggestion how send the output data and provide code?

 

I would be glad if anyone could help me!
 
 
 
Due to Anlog output problem.

I directly use the MATALB Code for Output data

 

 

AO = analogoutput('nidaq','Dev1');

chan = addchannel(AO,0);

duration = 1;

set(AO,'SampleRate',150)                              %Output Parameters:  150 samples per second on each channel.

set(AO,'TriggerType','Manual')

ActualRate = get(AO,'SampleRate');

len = ActualRate*duration;

data = sin(linspace(0,2*pi*500,len))';

putdata(AO,data)

 

start(AO)                                                        % CANNOT RUN STARTING HERE

trigger(AO)

wait(AO,1)

 

delete(AO)

clear AO

0 Kudos
Message 1 of 4
(5,806 Views)

Hi ptiamming,

Thank you for posting to NI Discussion Forums.  I understand that you are using the NI-USB 6009 and trying to program an analog output operation using Matlab.  Since Matlab is made by a different company (The Mathworks), we only support the use of our boards with our own software (LabVIEW) and not with Matlab.  You might have better luck going to The Mathworks support in order to get your questions answered.  Here is a link to the documentation on using the data acquisition toolbox in Matlab with different operations like analog output. Hopefully this will help you in your application!

Regards,
Vanessa L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(5,766 Views)
Hi,

This device doesn't have a hardware clock on output, so you cannot use PUTDATA/START -- you need to use PUTSAMPLE to output the data one point at a time.

-Rob
-----
Rob Purser
Manager, Test and Measurement
MathWorks
rob.purser@mathworks.com
0 Kudos
Message 3 of 4
(5,762 Views)

Hi ptiamming,

I would like to provide you with some additional resources for your project.  This first link is to another NI discussion forum thread about using M-series cards with DAQmx in Matlab.  This has some very useful general information.  Also for more information about the Data Acquisition toolbox purchased through the Mathworks, please visit this link.  Hopefully this will help!

Regards,
Vanessa L.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(5,667 Views)