Problem Loading okFrontPanel Library into MATLAB using 64 bit system


I have been working for the past day trying to get the FrontPanel library functions/ API to load correctly into Matlab with no luck. Let me give you the specs

OS: Windows 10 64 bit
Matlab: R2016b ( (64 bit) - I am also using a 64 bit support package to load ok
Front Panel: FrontPanelUSB-Win-x64-4.5.6

As far as I am concerned, it seems like I am running a pretty tight ship as far as my compatibility, yet I am still having problems, I will describe my process below, and the results.

  1. Following the Opal Kelly Front Panel Users Manual, I navigate to page 39, where the Matlab API is discussed. On that page, the user is instructed to load the okFrontPanel library into Matlab by typing the following command into the Matlab command line:

if ~libisloaded(‘okFrontPanel’)
loadlibrary(‘okFrontPanel’, ‘okFrontPanelDDL.h’)

Now, I at first copied and pasted this command into the command line blindly and got an error saying this:

Error using loadlibrary
Could not find file okFrontPanelDDL.h

Error in loadlibrary

That was a rookie mistake, I quickly realized that I hadn’t included Opal Kelly and its sub-folders into my Matlab path/session. I quickly did that, and ran the aforementioned command again. This time I got a new error, as follows:

Error using loadlibrary
There was an error loading the library “C:\Program Files\Opal Kelly\FrontPanelUSB\API\lib\Win32\okFrontPanel.dll”
C:\Program Files\Opal Kelly\FrontPanelUSB\API\lib\Win32\okFrontPanel.dll is not a valid Win32 application.

Caused by:
Error using loaddefinedlibrary
C:\Program Files\Opal Kelly\FrontPanelUSB\API\lib\Win32\okFrontPanel.dll is not a valid Win32 application.

Ok, the good news is I can read those errors, they are complaining that my version of Opal Kelly is not a valid 32 bit application. I do not know why Matlab even wants it to be a 32 bit application because no part of my system is 32 bit, but still at least it gave me a directory to look at, so I started digging into the directory it was pointing to and found two folders within C:\Program Files\Opal Kelly\FrontPanelUSB\API\lib. Those two folders are called

Win32 (Not a big surprise)



Ok cool, so I figured I had located the problem, silly Matlab was defaulting to the Win32 folder when it needed to be looking at the x64 folder, no big deal. So, I simply removed the Win32 sub-folder from my Matlab session by right clicking it in the internal Matlab directory: Right click Win32 > Remove from Path > Selected Folders and Sub-Folders.

So, having done that, I ran the command again. (The first command mentioned above) hoping for a better outcome, and I guess you could say I got an ok outcome, I mean I didn’t get any errors at least… Here’s what it said:

Warning: The data type ‘okTRegisterEntry#256’ used by structure okTFPGAResetProfile does not exist. The structure may not be

In loadlibrary
Warning: The data type ‘okTTriggerEntry#32’ used by structure okTFPGAResetProfile does not exist. The structure may not be usable.
In loadlibrary
Warning: The function return type of ‘okTDeviceSensor’ for function okDeviceSensors_GetSensor is not supported.
In loadlibrary
Warning: The data type ‘FcnPtr’ used by function okFirmware_PerformTasks does not exist.
In loadlibrary

So at this point it decides to dish out a bunch of warnings telling me that it doesn’t recognize several of the datatypes from within the library. Additionally, Matlab seems to think, at this point, that the library has loaded. To confirm that, I type in the following command, as directed by the Opal Kelly Front Panel Users Manual:


At this point, I’m presented with the most glorious trove of Matlab functions that I have ever seen. Super exciting! There are like 100 Opal Kelly functions prewritten and ripe for the picking!

Alas, for whatever reason, I am totally unable to use any of them. If I type the name of any of the functions into the command line, for example:

okDeviceSensors_Construct() %This is a function that doesn’t take arguments

Matlab responds with this:

Undefined function or variable ‘okDeviceSensors_Construct’.

It does the same thing for every function in the library!

I have all of the .mat files for each of the functions included in my path, yet it doesn’t seem to know where any of them are.

So, these are my two problems, I am still getting warnings about Matlab not knowing what the data types of some of the function parameters are, and even though the library is loaded, I can not access any of the functions. If anyone has the same problem, or the solution, I would be super appreciative to know how you went about solving it in a step by step guide. If I was unclear about ANYTHING involving my specific situation, please let me know, and I will answer fairly quickly.

Thanks in advance,