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!

*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

Matlab function block in simulink

Matlab function block in simulink

Matlab function block in simulink

How can I include a matlab user defined function with two inputs and two outputs to a simulink "matlab function block" ?

RE: Matlab function block in simulink

I could get two inputs fed to the function block by using the "mux" block. Now I am facing another issue.

In the function, the returned value is a real number. And I set the output width as 1 and set the output type as real. But  simulink gives an error "Evaluation of expression resulted in an invalid output.  Only finite double outputs are supported".

Does anyone have any idea about this?

RE: Matlab function block in simulink

Can you send a copy of the model for me to look at ?

RE: Matlab function block in simulink

Hi there. There is a block in Simulink called the S-Function block where you define the number of inputs and outputs. In order to use this block, you need first to develop a script using MATLAB Language and save it in an m-file. Then call the m-file into the S-Function block. Try to consider the "help" portion in the MATLAB Web Site.

Emmanuel A. Gonzalez, E.C.E.

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! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close