call matlab function from python but the argument is always mismatch
Ältere Kommentare anzeigen
I want to call fanbeam, the function defines in matlab like
proj = fanbeam(image, 1075,...
'FanSensorGeometry', 'arc',...
'FanSensorSpacing',0.1, ...
'FanRotationIncrement', 360/320);
At first I call the fanbeam in python like
proj = eng.fanbeam(image,1075.0,nargout=3)
it works well,But I want add some argument 'FanSensorGeometry', 'FanSensorSpacing',so I try to wrap them as a dict then pass the dict to fanbeam
para_dic = {"FanSensorSpacing":0.1,"FanRotationIncrement" :360.0/320}
proj = eng.fanbeam(hello,1075.0,para_dic,nargout=3)
But I got a wrong message
File "/media/Data/MyModel/train.py", line 118, in <module>
proj = eng.fanbeam(hello,1075.0,para_dic)
File "/home/wd/anaconda3/lib/python3.7/site-packages/matlab/engine/matlabengine.py", line 71, in __call__
_stderr, feval=True).result()
File "/home/wd/anaconda3/lib/python3.7/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/wd/anaconda3/lib/python3.7/site-packages/matlab/engine/fevalfuture.py", line 82, in result
self._result = pythonengine.getFEvalResult(self._future,self._nargout, None, out=self._out, err=self._err)
matlab.engine.MatlabExecutionError:
File /usr/local/MATLAB/R2019b/toolbox/images/images/private/check_fan_params.m, line 20, in check_fan_params
File /usr/local/MATLAB/R2019b/toolbox/images/images/fanbeam.m, line 168, in fanbeam
Function FANBEAM expected an even number of parameter/value arguments.
So,What should I do to pass these arguments to fanbeam function from python?
1 Kommentar
Matt J
am 20 Dez. 2019
Note: For years, fanbeam has exhibited weird non-linear behavior, which nobody seems to understand. I wouldn't trust it.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Call MATLAB from Python finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!