Read out "Sudden Motion Sensor" in Macbook Pro
2 次查看(过去 30 天)
显示 更早的评论
Has anybody out there ever tried to access
the "Sudden Motion Sensor" present in any
Macbook via Matlab? I searched the whole
web but couldn't find an obvious solution.
0 个评论
采纳的回答
Ken Atwell
2013-7-6
I'm not aware of anyone having done this. Apple apparently does not provide a Cocoa API to it, leaving you with informal, "tinkers" interfaces. A Stack Overflow article has some suggestions -- you would need either write some MEX glue code to interface Objective-C to MATLAB, or you may be able to use loadlibrary.
Another option would be to use this library, written Java. MATLAB has an interface to Java, so in theory this may be the easiest option.
In all cases, it looks like the options out there may not have been updated in the last handful of years, so they may or may not work with modern hardware (I'm guessing here). Also note that newish SSD drives do not have this hardware in question.
2 个评论
Ken Atwell
2013-7-7
This library was compiled in 2006, so my first guess is an 32/64 bit issue. Run this in the Terminal window:
cd path/to/file
file libUnimotionLib.jnilib
The file libUnimotionLib.jnilib was compiled for PowerPC and 32-bit Intel. All MATLAB releases on the Mac in recent years are 64-bit apps. This C library will need to be recompiled for 64-bit. Off the top of my head, I don't know how to compile native C code into a JNI library, sorry.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 C Shared Library Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!