How to pass a double value by reference
4 ビュー (過去 30 日間)
古いコメントを表示
We are using a COM Function that takes output doubles as an argument. When I tried to pass regular Matlab double values, I get this error.
Error using COM.Afgrow_Application/invoke
Error: Type mismatch, argument 1
I think this is because the type of the variable is “ out double ” Which is passed by reference.
%This Line Launches the afgrow application
afgrow = actxserver('Afgrow.Application');
%Set Units to English, 1 for metric
set(afgrow, 'Units', 0);
%Sets Spectrum to Constant Amplitude
invoke(afgrow, 'ConstAmplitudeSpectrum', 0)
%Set Multiplication Factor to 13.5
set(afgrow, 'SMF', 13.5);
%Set Initial Crack Length in C Direction to .05
set(afgrow, 'Visible', 1);
%invoke(afgrow, 'RunFrozPredict', cyc)
invoke(afgrow,'model',1030);
le=cell(2,2);
le=[0.05,0.05;0.05,0.05];
cyc = 0;
fc = 0;
fkc = 0;
fa =0;
fka = 0;
fct =0;
fkct =0;
invoke(afgrow, 'RunFrozPredict',cyc, fc, fkc, fa, fka, fct,fkc);
invoke(afgrow, 'CalculateBetas',le)
invoke(afgrow, 'RunPredict')
2 件のコメント
Walter Roberson
2018 年 6 月 21 日
You and James should consider working together; https://www.mathworks.com/matlabcentral/answers/406856-how-do-ipass-a-double-by-reference-into-a-com-object-s-methods
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Use COM Objects in MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!