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:
Programming using C on Matlab

Subject: Programming using C on Matlab

From: rufi24@hotmail.com

Date: 9 Jul, 2007 12:14:40

Message: 1 of 9

hi Group,

I am new to this group and just had one quick question.

This is my first time using Matlab and m trying to use Matlab to do C
programming. I am using Matlab version 7.2.0.232. I set the compiler
to Lcc C version 2.4.1 and tried to run an existing C file "yprime.c"
with mex yprime, but couldn't.

Just wondering if somebody could give me a hint on :

how to write , compile and run C programs using Matlab. or give me a
web-site
and how to run existing c programs .

thanks a lot.

Subject: Programming using C on Matlab

From: rufi24@hotmail.com

Date: 9 Jul, 2007 16:53:13

Message: 2 of 9

Anyone... i m waiting to start programming in C using Matlab.

thanks.



On Jul 9, 3:14 pm, ruf...@hotmail.com wrote:
> hi Group,
>
> I am new to this group and just had one quick question.
>
> This is my first time using Matlab and m trying to use Matlab to do C
> programming. I am using Matlab version 7.2.0.232. I set the compiler
> to Lcc C version 2.4.1 and tried to run an existing C file "yprime.c"
> with mex yprime, but couldn't.
>
> Just wondering if somebody could give me a hint on :
>
> how to write , compile and run C programs using Matlab. or give me a
> web-site
> and how to run existing c programs .
>
> thanks a lot.

Subject: Programming using C on Matlab

From: Krishna Pillai

Date: 10 Jul, 2007 03:13:40

Message: 3 of 9


I have Matlab7.1 and Lcc C 2.4.1. I could compile and run a small
piece of C code:

#include "mex.h"
void
mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
    printf("Hello world, enjoy the day\n");
}

On the matlab command window
>> mex test_c.c
>> test_c
Hello world, enjoy the day
>>

Krishna
http://dsplog.blogspot.com

Subject: Programming using C on Matlab

From: Steven Lord

Date: 10 Jul, 2007 10:14:34

Message: 4 of 9


<rufi24@hotmail.com> wrote in message
news:1184025193.579461.244580@r34g2000hsd.googlegroups.com...
> Anyone... i m waiting to start programming in C using Matlab.

Type "doc matlab" without the quotes at the MATLAB prompt. This will bring
up the Help Browser and open the MATLAB documentation. There's a manual
included in the documentation called "External Interfaces" -- this manual
describes how to call C and FORTRAN from MATLAB as MEX-files and how to call
MATLAB from C and FORTRAN, and includes examples of how to do so.

--
Steve Lord
slord@mathworks.com

Subject: Programming using matlab in c

From: Nirav

Date: 23 Jul, 2007 09:14:08

Message: 5 of 9

hello,
i got one confusion related matlab and c interfaceing. i mean that
how to call matlab file using c porograming. i mean i am making one
programing in c language and in this program i want to call matlab
file and i want to continue my c program. i heard that i have to
convert this file to in some format but i could not find this things
as u said in help menu.
thans in advance
cheers.
nirav

 Steven Lord wrote:
>
>
>
> <rufi24@hotmail.com> wrote in message
> news:1184025193.579461.244580@r34g2000hsd.googlegroups.com...
>> Anyone... i m waiting to start programming in C using Matlab.
>
> Type "doc matlab" without the quotes at the MATLAB prompt. This
> will bring
> up the Help Browser and open the MATLAB documentation. There's a
> manual
> included in the documentation called "External Interfaces" -- this
> manual
> describes how to call C and FORTRAN from MATLAB as MEX-files and
> how to call
> MATLAB from C and FORTRAN, and includes examples of how to do so.
>
> --
> Steve Lord
> slord@mathworks.com
>
>
>

Subject: Programming using matlab in c

From: Steven Lord

Date: 23 Jul, 2007 10:29:32

Message: 6 of 9


"Nirav" <nirav_bme@yahoo.co.in> wrote in message
news:ef5ce78.3@webcrossing.raydaftYaTP...
> hello,
> i got one confusion related matlab and c interfaceing. i mean that
> how to call matlab file using c porograming. i mean i am making one
> programing in c language and in this program i want to call matlab
> file and i want to continue my c program. i heard that i have to
> convert this file to in some format but i could not find this things
> as u said in help menu.

One of the chapters of the External Interfaces manual is titled "Calling
MATLAB from C and Fortran Programs". I suggest you read through that
chapter to learn how to call MATLAB M-files from your C code. Alternately,
you could create a MEX-file from your C code and call that MEX-file from
within MATLAB; that would allow you to have your C code run and call back
into MATLAB. That process is described in the chapter titled "Creating C
Language MEX-Files" in the External Interfaces manual.

--
Steve Lord
slord@mathworks.com

Subject: Programming using matlab in c

From: Nirav

Date: 24 Jul, 2007 04:52:39

Message: 7 of 9

Hi,
thanx for responsing me. actully i am working on image processing. in
my project i have to take images which is made sharp by matlab and i
have to program this images in c++. for that i have to transfer this
matlab program which i made in matlabpath line by line or i have to
save this program. my question is how to do this i mean how to
tranfer this images which can be called by c++.
thanx again sir

 Steven Lord wrote:
>
>

>
> "Nirav" <nirav_bme@yahoo.co.in> wrote in message
> news:ef5ce78.3@webcrossing.raydaftYaTP...
>> hello,
>> i got one confusion related matlab and c interfaceing. i mean
> that
>> how to call matlab file using c porograming. i mean i am making
> one
>> programing in c language and in this program i want to call
> matlab
>> file and i want to continue my c program. i heard that i have
to
>> convert this file to in some format but i could not find this
> things
>> as u said in help menu.
>
> One of the chapters of the External Interfaces manual is titled
> "Calling
> MATLAB from C and Fortran Programs". I suggest you read through
> that
> chapter to learn how to call MATLAB M-files from your C code.
> Alternately,
> you could create a MEX-file from your C code and call that MEX-file
> from
> within MATLAB; that would allow you to have your C code run and
> call back
> into MATLAB. That process is described in the chapter titled
> "Creating C
> Language MEX-Files" in the External Interfaces manual.
>
> --
> Steve Lord
> slord@mathworks.com
>
>
>

Subject: Programming using matlab in c

From: nirav darji

Date: 17 Aug, 2007 09:05:13

Message: 8 of 9

Hello,
I am Nirav. i am doing one project on matlab and c
interface. my confusion is i want to call numeric value in c
program which i got from matlab.may i have some suggetion
how can i call this perticuler value and i can store in c
program variable.
thanx in advance.
Regards
Nirav
Nirav <nirav_b,e@yahoo.co.in> wrote in message
<ef5ce78.5@webcrossing.raydaftYaTP>...
> Hi,
> thanx for responsing me. actully i am working on image
processing. in
> my project i have to take images which is made sharp by
matlab and i
> have to program this images in c++. for that i have to
transfer this
> matlab program which i made in matlabpath line by line or
i have to
> save this program. my question is how to do this i mean how to
> tranfer this images which can be called by c++.
> thanx again sir
>
> Steven Lord wrote:
> >
> >
>
> >
> > "Nirav" <nirav_bme@yahoo.co.in> wrote in message
> > news:ef5ce78.3@webcrossing.raydaftYaTP...
> >> hello,
> >> i got one confusion related matlab and c interfaceing.
i mean
> > that
> >> how to call matlab file using c porograming. i mean i
am making
> > one
> >> programing in c language and in this program i want to call
> > matlab
> >> file and i want to continue my c program. i heard that
i have
> to
> >> convert this file to in some format but i could not
find this
> > things
> >> as u said in help menu.
> >
> > One of the chapters of the External Interfaces manual is
titled
> > "Calling
> > MATLAB from C and Fortran Programs". I suggest you read
through
> > that
> > chapter to learn how to call MATLAB M-files from your C
code.
> > Alternately,
> > you could create a MEX-file from your C code and call
that MEX-file
> > from
> > within MATLAB; that would allow you to have your C code
run and
> > call back
> > into MATLAB. That process is described in the chapter titled
> > "Creating C
> > Language MEX-Files" in the External Interfaces manual.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> >
> >
> >

Subject: Programming using matlab in c

From: nirav darji

Date: 17 Aug, 2007 09:06:29

Message: 9 of 9

Hello,
I am Nirav. i am doing one project on matlab and c
interface. my confusion is i want to call numeric value in c
program which i got from matlab.may i have some suggetion
how can i call this perticuler value and i can store in c
program variable.
thanx in advance.
Regards
Nirav
Nirav <nirav_b,e@yahoo.co.in> wrote in message
<ef5ce78.5@webcrossing.raydaftYaTP>...
> Hi,
> thanx for responsing me. actully i am working on image
processing. in
> my project i have to take images which is made sharp by
matlab and i
> have to program this images in c++. for that i have to
transfer this
> matlab program which i made in matlabpath line by line or
i have to
> save this program. my question is how to do this i mean how to
> tranfer this images which can be called by c++.
> thanx again sir
>
> Steven Lord wrote:
> >
> >
>
> >
> > "Nirav" <nirav_bme@yahoo.co.in> wrote in message
> > news:ef5ce78.3@webcrossing.raydaftYaTP...
> >> hello,
> >> i got one confusion related matlab and c interfaceing.
i mean
> > that
> >> how to call matlab file using c porograming. i mean i
am making
> > one
> >> programing in c language and in this program i want to call
> > matlab
> >> file and i want to continue my c program. i heard that
i have
> to
> >> convert this file to in some format but i could not
find this
> > things
> >> as u said in help menu.
> >
> > One of the chapters of the External Interfaces manual is
titled
> > "Calling
> > MATLAB from C and Fortran Programs". I suggest you read
through
> > that
> > chapter to learn how to call MATLAB M-files from your C
code.
> > Alternately,
> > you could create a MEX-file from your C code and call
that MEX-file
> > from
> > within MATLAB; that would allow you to have your C code
run and
> > call back
> > into MATLAB. That process is described in the chapter titled
> > "Creating C
> > Language MEX-Files" in the External Interfaces manual.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> >
> >
> >

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