How to use Sap2000 api Matlab ?

13 ビュー (過去 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 Center および File ExchangeStatistics 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