DSPRelated.com
Forums

MATLAB algorithmic statements to C

Started by Hyoung Lee December 22, 2004
[Please excuse this topic if this it has been covered (I attempted to search 
past messages without success)].

Is there a translator that translates MATLAB algorithmic statements into C 
statements?

I have been using R14 MATLAB and MCC to translate M-Files into DLLs in the 
Windows environment. But, for TI DSPs, I had to manually translate MATLAB 
statements into C statements. When I used MCC to generate C files, they 
contain library calls to emulate the MATLAB execution environment. Though 
"Link for TI CCS" and "Realtime Workshop" help testing and validating DSP 
algorithms in the TI CCS environment, such C files embed MATLAB library 
calls, which are equivalent to MEX structures.

I need to automatically translate many DSP algorithms written in MATLAB 
(algorithmic statements only) to C (as opposed to manually translating or 
rewriting an equivalent algorithm in C); for example:

MATLAB statements:

if (intensity < max),
     intensity = intensity + increment;
else
     direction = down;
     intensity = intensity - increment;
end;

to C statements:

if (*intensity < max)
    (*intensity) += increment;
else {
    *direction = down;
    (*intensity) -= increment;
}

Is there a translator with which one can automate the process? Are there 
other solutions that will help translate MATLAB algorithmic statements to C 
statements?

Thanks,

Hyoung 


Yes,from 6.5 matlab support this convertion. However, matlab can not
convert m file to C, but can convert simulink-model into various C
platform including Embedded  C Code