Best practices for MATLAB code
Mostrar comentarios más antiguos
Best practices for MATLAB code
Does exist in MATLAB code some directive like C #ifdef
#ifdef name
program text
#else
more program text
#endif
or just I use if instruction?
Thanks,
F.
Respuestas (1)
Walter Roberson
hace alrededor de 24 horas
There is no equivalent to the C preprocessor in MATLAB.
The C pre-processor can do some ugly things, such as
#ifdef __CPLUS
void strlen (
#else
if (fiddlesticks) {
#endif
that can completely change the meaning of the code
There is no MATLAB equivalent of that.
The closest you can get is to use something like
if exist('name', 'var')
but you cannot achive the wholesale corruption of the code the way you can in C or C++.
Categorías
Más información sobre MATLAB Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!