Calling a method in a library that has an "HandlePtr" argument

3 ビュー (過去 30 日間)
Jason
Jason 2020 年 11 月 12 日
Hello I am trying to get a Z stage working with matlab. The Vendor (Dover Motion) have shared their dll. This is the first time I've dived into this part of matlab, so please excuse my lack of knowledge (I'm not really a c or c++ programmer either)
So I've read I need to use loadlibrary (and I've used an alias)
loadlibrary(lib_name,h_name, 'alias','lib') % lib is alias name for C-Motion library
libisloaded('lib') % Check to see its loaded OK
libfunctions('lib') % List methods in the command window
libfunctionsview('lib') % List methods in fancy graphic!
This works fine, and I get a nice graphic showing the methods/functions.
One of those functions I want to use is: PMDSetupAxisInterface_Serial
This is where I am stuck - with the argument (tagPMDAxisHandlePtr) - I don't really know what i'm doing but have tried.
I've read that to call a method inside a dll, to use calllib, so I have tried:
handle = libstruct('tagPMDAxisHandle');
%handle = libpointer('tagPMDAxisHandle');
calllib('lib','PMDSetupAxisInterface_Serial',handle,0,1)
But it cause matlab to crash.
Here's the output of
handle = libstruct('tagPMDAxisHandle');
handle =
lib.tagPMDAxisHandle
and
handle = libpointer('tagPMDAxisHandle');
handle =
libpointer
Thnaks for any help
Jason

回答 (0 件)

カテゴリ

Help Center および File ExchangeCall C from MATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by