Matlab Coder: C code generated, how to compile?

Hi,
I have generated C code a single matlab function. I need to call this function from other C code.
Can anyone point me towards any information on writing a makefile for matlab codegen c code?
Thanks,
Further Details:
Linux, 64bit OS, using gcc.
After code generation i have a folder full of files centered around function.c
i want to call function(args) from a separate file main.c . How do i compile the codegen files into an object for later linking to my main.c ?

3 comentarios

Kaustubha Govind
Kaustubha Govind el 30 de Abr. de 2012
There should be a makefile generated along with the code. Why not add your main.c to the existing Makefile and continue to use that?
Tim
Tim el 6 de Mayo de 2012
Kaustubha, Thanks for your reply. I believe there is a make file of the form 'function_rtw.mk'. I have added my 'main.c' to its 'USER_SRCS' arguments and have added an include statement to 'function.h' within 'main.c' however i am unable to compile the code with the command:
make function_rtw.mk
How does one use these make files?
Walter Roberson
Walter Roberson el 6 de Mayo de 2012
As I wrote below, once you have a make file this becomes a Linux question rather than a MATLAB question. You would use the Linux resources for solving the problem, starting with
man make
In particular, read about -f

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Abr. de 2012

0 votos

Once you have the C code generated, this becomes a C / Linux question rather than a MATLAB question.
You might want to use GNU automake

Más respuestas (1)

gregoire
gregoire el 30 de Abr. de 2012
Hi! I dont have matlab coder; but I want to test it; Someone can help me to generate this matlab code in C for me ? Tanks for your helping.
*% filtering a signal :low pass filtering
clear all;
close all;
Fe=1000;
F1=40;
F2=400;
A=1;
t=0:1/Fe:2;
s1 = A*sin(2*pi*F1*t);
s2 = A*sin(2*pi*F2*t);
Stot=s1+s2;
[b,a] = butter(3,(30/(Fe/2)),'low');
y= filter(b,a,Stot);
spectrogram(y,512,[],512,Fe); % to view as the signal is filtered*

2 comentarios

Walter Roberson
Walter Roberson el 30 de Abr. de 2012
MATLAB Coder cannot generate graphics, and it cannot "clear all"
Juan Rojas
Juan Rojas el 20 de Feb. de 2013
You can get a trial version.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Coder en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

Tim
el 24 de Abr. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by