How to use Sap2000 api Matlab ?

조회 수: 14 (최근 30일)
Ali
Ali 2014년 11월 10일
편집: Walter Roberson 2020년 1월 21일
Hello
I work on a project, and I need programming with Matlab and Run in Sap2000. But when I use code one message happen: "Warning: ActiveX - attempt to convert unsupported SAFEARRAY type failed - substituting NAN "
how I can solve that?
my code:
clc; clear all;
x=(0.645*10^-4)+rand(10,1)*(50-0.645)*10^-4;
%% Start Sap2000
feature('COM_SafeArraySingleDim', 1); feature('COM_PassSafeArrayByRef', 1);
SapObject = actxserver('Sap2000v16.SapObject');
SapObject.ApplicationStart; ret=SapObject.SapModel.InitializeNewModel; ret=SapObject.SapModel.File.OpenFile('C:\Users\ali\Desktop\EXAM\EXAM01.sdb');
% SapObject.ApplicationStart(2, 1, 'C:\Users\ali\Desktop\EXAM\EXAM01.sdb'); SapModel= SapObject.SapModel;
%% Modify the sections area
for k=1:1:10
ret=SapModel.PropFrame.SetChannel( num2str(k) , 'folad' , x(k,1)^0.5 , x(k,1)^0.5 , 0.9*x(k,1)^0.5 , 0.4*x(k,1)^0.5 );
end
%% Save new model
ret=SapModel.File.Save('C:\Users\ali\Desktop\EXAM\EXAM01.sdb');
%% Run analisis
ret=SapObject.SapModel.Analyze.RunAnalysis;
%% Get Stress from Sap2000
ret = SapObject.SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput; ret = SapObject.SapModel.Results.Setup.SetCaseSelectedForOutput('DEAD');
Name = '1'; Element = 1; NumberResults = 0; Obj = cellstr(' '); ObjSta = zeros(1,1,'double'); Elm = cellstr(' '); ElmSta = zeros(1,1,'double'); LoadCase = cellstr(' '); StepType= cellstr(' '); 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);
disp(P);
  댓글 수: 1
Osman TUNCA
Osman TUNCA 2015년 6월 25일
Hi Where did u from this codes? I can not find orjinal document

댓글을 달려면 로그인하십시오.

답변 (1개)

said toghani
said toghani 2019년 11월 5일
hello you define parameters in wrong way.

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by