How call a matlab function in the c compiled library in python?
3 ビュー (過去 30 日間)
古いコメントを表示
Hello
I'd like to write the code calling the matlab function from shared c library.
But when I call the function in the python using ctype library, I immediately got an error by the segmentation fault.
I don't know what's wrong with it and I'm not even know if it's possible or not.
Do you have any example code?
What I'm trying to do is like this code below.
import ctypes
cdll = ctypes.cdll.LoadLibrary("myLib.so")
if not cdll.myLibInitialize() :
print "** Error : library is not initiallized ..."
exit
else :
freturn = ctypes.c_char_p("temp.mat")
ptr_freturn = ctypes.pointer(freturn)
arg = ctypes.c_int(9)
ptr_arg= ctypes.pointer(arg)
cdll.mlfTest_func(1, ptr_freturn , ptr_arg)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Python Package Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!