×
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

Matlab crash when using SAP API

Matlab crash when using SAP API

Matlab crash when using SAP API

(OP)
Hello to everyone,
I got a problem when trying to retrieve the displacement history step-by-step dor node 282 using matlab. I'm using Matlab 2015a and SAP2000 v.17.2.0. The problem is that matlab crashes and I don't know what's going wrong, I'm very new to OAPI.

I'm using the following code to run analyses:
clear all;clc;
ProgramPath = 'J:\SAP\SAP2000.exe';
feature('COM_SafeArraySingleDim', 1);
feature('COM_PassSafeArrayByRef', 1);
%% create OAPI helper object
helper = actxserver('Sap2000v17.helper');
helper = helper.invoke('cHelper');
%% create Sap2000 object
SapObject = helper.CreateObject(ProgramPath);

%% start Sap2000 application
SapObject.ApplicationStart;
SapModel = SapObject.SapModel;
ret = SapModel.InitializeNewModel;
FileName = ModelPath;
ret = SapModel.File.OpenFile(FileName);

ret = SapModel.Analyze.RunAnalysis();
ret = SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput;
ret = SapModel.Results.Setup.SetCaseSelectedForOutput('SismaX');
ret = SapModel.Results.Setup.SetOptionModalHist(2);
NumberResults = 0;
ObjectElm = 0;
Obj = cellstr(' ');
Elm = cellstr(' ');
LoadCase = cellstr(' ');
StepType = cellstr('Time');
StepNum = reshape(0:200,201,1);
U1 = reshape(0:200,201,1);
U2 = reshape(0:200,201,1);
U3 = reshape(0:200,201,1);
R1 = reshape(0:200,201,1);
R2 = reshape(0:200,201,1);
R3 = reshape(0:200,201,1);

Until this part, the code works. When adding the followin string:

[ret, NumberResults, Obj, Elm, LoadCase, StepType, StepNum, U1, U2, U3, R1, R2, R3] = SapModel.Results.JointAccAbs('282', ObjectElm, NumberResults, Obj, Elm, LoadCase, StepType, StepNum, U1, U2, U3, R1, R2, R3);

Matlab crashes

Anyone could help me? every suggestion would be very appreciated.
Thanks in advance
Marco.



RE: Matlab crash when using SAP API

Did you set the mass source correctly?

Jason McKee
proud R&D Manager of
Cross Section Analysis & Design
Software for the structural design of cross sections
Moment Curvature Analysis
Reifnorcement Design etc.

RE: Matlab crash when using SAP API

(OP)
The program correctly run the analyses when not using matlab.

RE: Matlab crash when using SAP API

I have the same problem. I run my code and it works just fine. But anther day,I run the same code and MATLAB crushes after several loops. It is random!

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