Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab Funtion Help

Status
Not open for further replies.

LabJack

Mechanical
Joined
Apr 27, 2005
Messages
1
Location
US
I am creating a function that needs to have two ouputs but I can only get it to output one or the other and not both at the same time. Here is the function

function [ljError ljValue] = ljud_eGet(ljHandle, IOType, Channel, ljValue, x1);
[ljError ljValue] = calllib('labjackud','eGet',ljHandle,IOType,Channel,ljValue,x1);

with the mfile as above I get "ans = 0", which is correct for the ljError value. If I change the first part of the function to read "function [ljValue] = ......" then I get "ans = 4.67" which is also correct.

How can I change my function so that if outputs both? The preferred output would be "ans = 0 ans = 4.67".
 
Your functions is correct. You just need to call it with proper output arguments.
Code:
[err val] = ljud_eGet(input1,input2,....)
Then your variables err and val contains the answers from the function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top