How to get code in C?

1 view (last 30 days)
Sagar Damle
Sagar Damle on 19 Apr 2013
I have a [3*8] matrix (which is matrix 'a').I take a [1*8] matrix (which is matrix 'b') from user as input to arrange the matrix 'a' as follows –
a = a(:,b)
I want to get equivalent C code for this instruction. I have MATLAB 2010a and have set compiler as‘Microsoft Visual Studio 2008’ from 'mex –setup'.
When I use 'emlc' function to get C library for this function,I get report that 'Code generated successfully'. But I am not getting C code for this instruction in 'abc.c'.
Is it a case that the function requires recursion and recursive functions are not shown by 'emlc'?
I have written this function –
function abc
a = [1 2 3 4]
b = [4 3 2 1]
c = a(:,b)
Values of 'a' and 'b' are only for instance. My aim is to get C code for
a = a(:,b).
I have verified mex file. It is running.
Also I want to suppress the files from being generated such as
rtGetInf.c, rtGetNaN.c, rt_nonfinite.h.
Can anyone tell me solutions for these 2 problems?
Thank you !
  1 Comment
Kaustubha Govind
Kaustubha Govind on 19 Apr 2013
Could it be because you're not returning 'c' as the output of your function? Try changing that to:
function c = abc
a = [1 2 3 4]
b = [4 3 2 1]
c = a(:,b);
I don't believe there is a way to suppress creation of the rt_* files.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!