×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Runtime error while calling matlab 7.0.1 from visual c++ 6.0

Runtime error while calling matlab 7.0.1 from visual c++ 6.0

Runtime error while calling matlab 7.0.1 from visual c++ 6.0

(OP)
I've included the "engine.h", and there is no problem while compiling. But when I execute the code, a first chance exception is ouccured while excuting "ar = mxGetPr(mp);"

The error is:
First-chance exception in CameraTest.exe (LIBMX.DLL): 0xC0000005: Access Violation
 
Can anyone help me? Your help will be very appreciated.
The source code is:
---------------------------------------
Engine *ep;
Engine *ep;
mxArray *mp, *ans;
double *ar, *detreal;
int i,j;
mp = mxCreateDoubleMatrix(3,3,mxREAL);
ar = mxGetPr(mp);
for (i=0; i<3; i++)
    for (j=0; j<3; j++) {
        *ar=1;
        ar++;
    }

ep = engOpen("");
engPutVariable(ep, "T", mp);
engEvalString(ep,"d = sum(sum(T));");
ans=engGetVariable(ep,"d");
detreal=mxGetPr(ans);
engClose(ep);
------------------------------------------

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources