Block Throttle Pipe using MATLAB API

I am trying to use the Block Throttle Pipe in MATLAB with the following command:

d = [1 3 5 7 11];
tmp = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_WriteToBlockPipeIn’, xptr, hex2dec(‘80’), 1024, d, 16);

I get the following error:
??? Error using ==> calllib
Parameter must be scalar.

I assume it is referring to the vector d that needs to be a scalar. However, in the help section for using WriteToBlockPipeIn, it states that epValue is a vector.
Any suggestions on how to fix this or what I may be doing wrong?

I figured out a solution. But can’t say if it is the solution. I used the following MATLAB script:
d = round(255*rand(1024,1));
tmp = writetoblockpipein(xptr, hex2dec(‘80’), 16, d, 1024)
[ok_SendData, voidPtr] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_ActivateTriggerIn’,xptr, hex2dec(‘40’),0);
[voidPtr] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_UpdateWireIns’,xptr);
[voidPtr] = calllib(‘okFrontPanel’, ‘okUsbFrontPanel_UpdateWireOuts’,xptr);
epValue = readfromblockpipeout(xptr, hex2dec(‘A0’), 16, 1024);

where writetoblockpipein and readfromblockpipeout are the okusbfrontpanel functions that came with the software. I slightly modified both those files.

If anyone has a better way to accomplish the original task, please let me know.

I don’t have my XEM connected now, but it looks like perhaps a transpose will do the trick. It works with the 1024x1 array, but fails with the 1x5 array.

d = round(255*rand(1024,1));
whos d
Name Size Bytes Class Attributes

d 1024x1 8192 double

d = [1 3 5 7 11];
whos d
Name Size Bytes Class Attributes

d 1x5 40 double

d=d’;
whos d
Name Size Bytes Class Attributes

d 5x1 40 double