- Have a supported version of python installed: CPython 2.7, 3.7, 3.8, or 3.9
- In Matlab, set it up with pyenv, e.g.: pyenv('Version','path/to/supportedVersion')
- Run (do not import):
convert python code to MATLAB
2 次查看(过去 30 天)
显示 更早的评论
Hi, everyone! I need a help to convert python code to matlab about mie scattering in homogenous sphere, below is my python code. I add 'z' variable to get the value of scattering.
import PyMieScatt as ps
mie = ps.MieQ(1.525+0.0011j,450,300,asDict=True) %index refractive, wavelength, diameter of particle
z = mie['Qsca']
2 个评论
Chris
2021-11-6
PyMieScatt is not a trivial program. If you want something similar to use in native Matlab, you will probably have to find an implementation somewhere else, or write your own. If you want to try using python from Matlab, you can follow the below steps (but Matlab freezes for me when I try this).
mie = py.PyMieScatt.MieQ(1.525+0.0011j,450,300,asDict=True);
Further information:
Cris LaPierre
2021-11-7
Admitting that I know nothing about this topic, a keyword search indicates this file exchange submission might be of interest.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!