Alright, I figured it out. If anyone is interested in the future my functions look something like this:
[CODE]function fwd_pb_Callback(hObject, eventdata, handles)
%Init stuff
xptr = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_Construct’);
xem.ptr = xptr;
sn = ‘jwQkOcdasz’;
bitmask = hex2dec(‘ffff’);
[ok_ErrorCode, voidPtr, opened_sn] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_OpenBySerial’, …
xptr, strcat(sn)); %convert char array to string
%Set address value for move forward
setwireinvalue(xem, hex2dec(‘00’), hex2dec(‘0001’), bitmask);
updatewireins(xem);[/CODE]
I found xptr, xem.ptr, sn, and bitmask were the only required strings to put in the function in order to use the setwireinvalue and updatewireins function.
In the varargout_yourGUIName_Outputfcn function I included the following code, which automatically initializes the front panel interface and loads the frontpanel matlab functions when you start the GUI.
[CODE]
%If a different machine is used these paths will need to be changed
%To ensure the correct functions and .dlls are found
addpath(‘C:…\Matlab API’);
addpath(‘C:…l\FrontPanel\API’);
addpath(’.\okusbfrontpanel’);
% from ok_getdevicelist:
if ~libisloaded(‘okFrontPanel’)
loadlibrary(‘okFrontPanel’, ‘okFrontPanelDLL.h’);
end
% Try to construct an okUsbFrontPanel and open it.
xptr = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_Construct’);
num = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_GetDeviceCount’, xptr);
for j=1:num
[m,voidPtr] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_GetDeviceListModel’, xptr, j-1);
[voidPtr,sn] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_GetDeviceListSerial’, xptr, j-1, ’ ', 10);
if ~exist(‘snlist’, ‘var’)
mlist = m;
snlist = sn;
else
mlist = [mlist;m];
snlist = char(snlist, sn);
end
end
% end from ok_getdevicelist
% the OK matlab scripts assume/require the syntax: ‘obj.ptr’!
xem.ptr = xptr;
%---------------------------------------------------------------------------
% init stuff
[ok_is_enabled, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsFrontPanelEnabled’,xptr);
[ok_is_FP3sup, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsFrontPanel3Supported’,xptr);
[ok_is_open, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsOpen’,xptr);
[ok_ErrorCode, voidPtr, opened_sn] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_OpenBySerial’, …
xptr, strcat(sn)); %convert char array to string
[ok_HDL_load, voidPtr, HDLfile] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_ConfigureFPGA’,xptr, …
‘C:\lab\acassidy\projects\if_neuron\xil\prj_top_d.0717c.bit’);
[ok_is_open, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsOpen’,xptr);
[ok_is_enabled, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsFrontPanelEnabled’,xptr);
[ok_is_FP3sup, voidPtr] =calllib(‘okFrontPanel’, ‘okUsbFrontPanel_IsFrontPanel3Supported’,xptr);
%---------------------------------------------------------------------------
% useful values
bitmask = hex2dec(‘ffff’);
%---------------------------------------------------------------------------
% Init
fprintf(‘Initializing FPGA…\n’);[/CODE]