Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Using AIBurst within Matlab using dll

U12 Matlab AIBurst

  • Please log in to reply
1 reply to this topic

#1 Martine

Martine
  • Members
  • 6 posts

Posted 14 November 2013 - 08:34 AM

Dear all,

 

I am new to Labjack and trying to record AI0 until AI4 using AIBurst.

 

Using the examples from the website, I was able to call the AIsingle using the following code

 

[errorCode, idnum, stateIO, overVoltage] = lj.LabJack.AISample(idnum, demo, stateIO, updateIO, ledOn, numChannels, channels, gains, disableCal, overVoltage, voltages);

 

I now want to repeat this for the AIBurst method:

 

[errorCode,idnum,scanRate, voltages, stateIO, overVoltage] = lj.LabJack.AIBurst(idnum, demo, stateIO, updateIO, ledOn, numChannels, channels, gains, scanrate, disableCal, triggerIO,triggerState,numscans, timeout, voltages,stateIOout,transferMode);

However this gives the following error

 

??? No method 'AIBurst' with matching signature found for class 'lj.LabJack'.

 

I am not sure if matlab can't find the method AIBurst, or the error is a result from wrong input/output parameters.

 

I am using the dll method which is defined on top of the script

 

ljAsm = NET.addAssembly('D:\LondonProject\MatlabLabjack\LabJackDotNet\driver\LJDotNet.dll');

I hope someone can help me with this problem. The full script is attached.

 

Attached Files



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 November 2013 - 05:08 PM

It looks like the issue is incorrect input/output parameters.

 

You'll want to create the voltage and stateIOOut arrays like this:

voltages = NET.createArray('System.Single', [4096, 4])
stateIOOut = NET.createArray('System.Int32', 4096)

 

AIBurst would look like this in MATLAB:

%voltages and stateIOOut array values need to be filled with zeroes for the AIBurst call.
for i = 1:4096
    voltages(i, 1) = 0;
    voltages(i, 2) = 0;
    voltages(i, 3) = 0;
    voltages(i, 4) = 0;
    stateIOOut(i) = 0;
end

[errorCode, idnum, scanRate, overVoltage] = lj.LabJack.AIBurst(idnum, demo, stateIO, updateIO, ledOn, ...
    numChannels, channels, gains, scanrate, disableCal, triggerIO, triggerState, numscans, timeout, ...
    voltages, stateIOOut, overVoltage, transferMode);

 

To see the MATLAB returns and parameters of the U12 functions use methodsview on the U12 .NET assembly dll. For example:

ljAsm = NET.addAssembly('\PATH_TO_DLL\LJDotNet.dll');
methodsview(lj.LabJack)

 

AIBurst is documented here for parameter documentation:

 

http://labjack.com/s...users-guide/4.7





Also tagged with one or more of these keywords: U12, Matlab, AIBurst

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users