Using the C++ Math Library | ![]() ![]() |
Variable Declaration
In addition to requiring different syntax, C++ insists that you declare all variables explicitly before using them. The declarations do not have to appear at the top of a function as they do in C, but may be interspersed throughout your code.
Declare array variables as type mwArray
. Note that in general mwArray
objects have value semantics in the MATLAB C++ Math Library. They are passed by value to functions; they are not modified by functions; they are returned by value.
To modify the value of an mwArray
object within a function, pass the mwArray
object to that function by reference, either as a pointer (mwArray *
) or a reference (mwArray &
).
![]() | Syntax | Function Calling Conventions | ![]() |