Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

OAPI (sap2000-matlab)

Status
Not open for further replies.

idinhobbollahi

Civil/Environmental
Joined
Aug 2, 2014
Messages
2
Location
US
hi Im new in OAPI , i cant exract farme force in code, and all the time isee erorr, plz help if any one have any code or idea,
my code
close all
clc

% Link Sap2000 and matlab for passing one-dimensional arrays
feature('COM_SafeArraySingleDim', 1);

% Link Sap2000 and matlab for passing non-scalar arrays by reference
feature('COM_PassSafeArrayByRef', 1);

% Create Link Between Matlab and SAP
SapObject = actxserver('Sap2000v15.SapObject');

% Start SAP
SapObject.ApplicationStart;
% Create SAP Model
SapModel = SapObject.SapModel;
% initialize model
ret = SapModel.InitializeNewModel;
%open an existing file
ret = SapObject.SapModel.File.OpenFile('C:\API\idin2');

% Run model (this will create the analysis model)
ret = SapModel.Analyze.RunAnalysis();


ret = SapObject.SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput;
ret = SapObject.SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD');

Name = '38';
Element = 1;
NumberResults = 0;
(Object);
ObjSta = zeros(1,1,'double');
(Elm );
ElmSta = zeros(1,1,'double');
(LoadCase);
(StepType);
StepNum = zeros(1,1,'double');
P = zeros(1,1,'double');
V2 = zeros(1,1,'double');
V3 = zeros(1,1,'double');
T = zeros(1,1,'double');
M2 = zeros(1,1,'double');
M3 = zeros(1,1,'double');

[ret, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3] = SapObject.SapModel.Results.FrameForce(Name, Element, NumberResults, Obj, ObjSta, Elm, ElmSta, LoadCase, StepType, StepNum, P, V2, V3, T, M2, M3);
 
Try defining string type inputs as cell strings
Object = cellstr(' ');
Elm = cellstr(' ');
LoadCase = cellstr(' ');
StepType = cellstr(' ');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top