matlab function in python's return is incomplete
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
I want to use matlab function in python, and the matlab function is difined like:
function [gam3,gam4]=calcgamma(N,FAV,NQ);
which the return is initialized as :
gam3=zeros(length(FAV),1);
gam4=zeros(length(FAV),NQ);
I omit this function's main calculation codes because I think it's unnecessary.
And running this function,the result should like that:
disp([gam3,gam4])
% below is the printed result
-12.6500 270.2543
0 1.5507
which means result should be :
gam3=[-12.6500, 0.0]
gam4=[270.2543, 1.5507]
In python, I use the MATLAB engine API for python, it already worked in other python tests. And the main codes like this:
f = [0.1, 0.5]
f = matlab.double(f)
n = 100
n = matlab.double([n])
result = eng.calcgamma(n,f,1)
print(result)
And it only prints this:
[ [-12.65996639124823], [0.0] ]
which means it only prints 'gam3' but omits 'gam4'.
I don't know the reason or solution. Please help me LOL.
Réponses (1)
Steven Lord
le 30 Sep 2019
0 votes
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!