Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to call/use S-function in MATLAB command line?

Subject: How to call/use S-function in MATLAB command line?

From: Mohamed

Date: 30 Apr, 2013 00:28:11

Message: 1 of 3

Hello all,

I have a user defined s-function written in C, and it's working perfectly in Simulink.

Now, I would like to call/use this s-function, directly, in the command line rather than using simulink. The reason is that I want to do a real time test and I only know how to do that using m-file, or command line.

So is there a possibility that I can do that?

Thanks.

Subject: How to call/use S-function in MATLAB command line?

From: Navan Ruthramoorthy

Date: 30 Apr, 2013 20:17:11

Message: 2 of 3

"Mohamed" wrote in message <kln36q$3q9$1@newscl01ah.mathworks.com>...
> Hello all,
>
> I have a user defined s-function written in C, and it's working perfectly in Simulink.
>
> Now, I would like to call/use this s-function, directly, in the command line rather than using simulink. The reason is that I want to do a real time test and I only know how to do that using m-file, or command line.
>
> So is there a possibility that I can do that?
>
> Thanks.

Hi Mohamed,

You cannot call a C s-function from MATLAB. If you have a model using this S-Function you can run that model using "sim" command from your MATLAB code.

Navan

Subject: How to call/use S-function in MATLAB command line?

From: Mohamed

Date: 30 Apr, 2013 20:39:10

Message: 3 of 3

"Navan Ruthramoorthy" wrote in message <klp8s6$qoo$1@newscl01ah.mathworks.com>...
> "Mohamed" wrote in message <kln36q$3q9$1@newscl01ah.mathworks.com>...
> > Hello all,
> >
> > I have a user defined s-function written in C, and it's working perfectly in Simulink.
> >
> > Now, I would like to call/use this s-function, directly, in the command line rather than using simulink. The reason is that I want to do a real time test and I only know how to do that using m-file, or command line.
> >
> > So is there a possibility that I can do that?
> >
> > Thanks.
>
> Hi Mohamed,
>
> You cannot call a C s-function from MATLAB. If you have a model using this S-Function you can run that model using "sim" command from your MATLAB code.
>
> Navan

Thanks Navan for the reply. I actually to re-coded the C-code into a MATLAB code, and it worked fine.
Thanks again for the information.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us