MATLAB: Is there a difference between writing MATLAB files and writing C++ programs using the C++ Math Library

.mcfilelibrary

I would like to know the differences between programming with MATLAB and writing C++ programs with the MATLAB C++ Math Library?

Best Answer

This is a very involved question, particularly since files that are intrepreted by MATLAB and C++ programs must be compiled by a C++ compiler. However, the MATLAB C++ Math Library was designed so that MATLAB programmers could quickly learn how to use it; it is as similar to MATLAB as possible. Here are the major differences:
1. Some operators, such as : (colon) and ' (transpose) are not available as operators; they are instead available as function calls (colon() and transpose() in this case).
2. Functions in C++ can only have one return value. This means that the C++ equivalents of MATLAB functions with multiple return values use output parameters to accomodate the extra return values.
3. In C++ all variables must be declared before being used.
These differences are explained in greater detail in the MATLAB C++ Library Users Guide.