How to pass a double value by reference
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 21 Juin 2018
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
Réponses (0)
Voir également
Catégories
En savoir plus sur Use COM Objects in MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!