Why do I have difficulty in using the << operator with the ramp function with mwArray?
Mostrar comentarios más antiguos
Why do I have difficulty in using the << operator with the RAMP function with the mwArray interface?
The following code segment produces an error when compiled to a stand-alone and executed using MBUILD:
1. Create test.cpp from the following C++ code:
#include "matlab.hpp"
void main()
{
mwArray x;
x=ramp(-10,0.1,9);
cout<<x<<endl;
}
2. Compile it using mbuild:
mbuild -setup %select VC++
mbuild -v test.cpp
3. Execute the code:
!test
from the MATLAB prompt.
I should receive the following error message:
abnormal program termination
[
However, if I replace the code in test.cpp with the following:
#include "matlab.hpp"
void main()
{
mwArray x;
x=ramp(-10,0.1,11);
cout<<x<<endl;
}
and run steps 2 and 3 again, I receive a listing of the contents of 'x' rather than the error message.
The problem occurs when the last argument to RAMP is less than 10 (the absolute value of the first variable).
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deploy to C++ Applications Using mwArray API (C++03) en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!