|
From: robert.yu on 19 Jun 2008 00:04 On Jun 17, 5:19 am, "Arslan " <arslkha...(a)gmail.com> wrote: > what are the limitations in using simulink model to create > c code. ie. are there any specific blocks that cannot be > used or are there any logical limitations. > Moreover if i use mex to convert m-files into c code; are > there any matlab programming structures that i need to > avoid to ensure c code generation. > In short what are the short commings of the two methods > stated above (mfile to C code & simulink model to C code). > and which one is better. emlc will convert EML ("embedded matlab") to C; EML is a subset of the matlab language: http://www.mathworks.com/products/featured/embeddedmatlab/ The biggest restrictions are that your matlab variables cannot change in type or shape, and you don't have all the toolbox function available. The first restriction means that you cannot write code like this: x=rand(10,1); y=find(x>0.5); % invalid for eml; y's length indeterminate Of course, if you are writing your matlab from scratch with these restrictions in mind, this may not be a showstopper. Regarding the second part of your queston: the mex command doesn't convert M to C; it merely compiles and links existing C into a form which can be invoked from MATLAB.
From: Arslan on 19 Jun 2008 06:32 robert.yu(a)gmail.com wrote in message <399941fc-9890-4bb0- ab79-522e2765f329(a)s21g2000prm.googlegroups.com>... > On Jun 17, 5:19 am, "Arslan " <arslkha...(a)gmail.com> wrote: > > what are the limitations in using simulink model to create > > c code. ie. are there any specific blocks that cannot be > > used or are there any logical limitations. > > Moreover if i use mex to convert m-files into c code; are > > there any matlab programming structures that i need to > > avoid to ensure c code generation. > > In short what are the short commings of the two methods > > stated above (mfile to C code & simulink model to C code). > > and which one is better. > > emlc will convert EML ("embedded matlab") to C; EML is a subset of the > matlab language: > http://www.mathworks.com/products/featured/embeddedmatlab/ > > The biggest restrictions are that your matlab variables cannot change > in type or shape, and you don't have all the toolbox function > available. The first restriction means that you cannot write code > like this: > > x=rand(10,1); > y=find(x>0.5); % invalid for eml; y's length indeterminate > > Of course, if you are writing your matlab from scratch with these > restrictions in mind, this may not be a showstopper. > > Regarding the second part of your queston: the mex command doesn't > convert M to C; it merely compiles and links existing C into a form > which can be invoked from MATLAB. > > Thanks for the help i did not know about the eml Moreover by mex i meant mcc -l it is a command from older versions of matlab that can be used to convert matlab code to c code try the following link http://web.bsu.edu/tti/5_1/5_1f/5_1f.htm
|
Pages: 1 Prev: Matlab on a thumb drive? Next: read text and binary data |