Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Apr 27, 2005
1
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".
 
Replies continue below

Recommended for you

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