How to get code in C?

4 次查看(过去 30 天)
Sagar Damle
Sagar Damle 2013-4-19
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 个评论
Kaustubha Govind
Kaustubha Govind 2013-4-19
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geology 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by