×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Matlab Funtion Help

Matlab Funtion Help

Matlab Funtion Help

(OP)
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".

RE: Matlab Funtion Help

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources