Matlab with PT104

Post your MATLAB discussions here
Post Reply
pt104user
Newbie
Posts: 0
Joined: Mon Nov 21, 2016 9:44 am

Matlab with PT104

Post by pt104user » Mon Nov 21, 2016 10:02 am

Hello @all,

i recently try to establish a connection to the PT104 Data Logger.
Unfortunally i ran into problems with it.

Here is what i have already done:
- I downloaded the SDK from here: "https://www.picotech.com/downloads/_lig ... kit-32-bit"
- i installed the SDK
- i tried the the following example:

Code: Select all

cd 'C:\Program Files (x86)\Pico Technology\SDK\src\MATLAB\usbpt104\win32';
dllPath = 'C:\Program Files (x86)\Pico Technology\SDK\lib\usbpt104.dll';
loadlibrary(dllPath, @USBPT104MFile, 'alias', 'lib');
serials = '';
serials_ptr = libpointer('cstring',serials);
seriallen = uint32(0);
seriallen_ptr = libpointer('uint32Ptr',seriallen);

[status, serials, seriallen] = calllib('lib', 'UsbPt104Enumerate', serials_ptr, seriallen_ptr, 1);

pause(0.5);
disp(serials);
What i get as a output is:

Code: Select all

Error using calllib
Array must be numeric or logical or a pointer to one 
Can you please give me a hint of what i am doing wrong?

I can't find any examples in Matlab within the SDK (just a reference in the programmers guide "usbpt104pg.en r7" on page 15).

Thank you a lot for your effort.

pt104user
Newbie
Posts: 0
Joined: Mon Nov 21, 2016 9:44 am

Re: Matlab with PT104

Post by pt104user » Tue Nov 22, 2016 7:40 am

What i now have noticed is that i did not mention the connection type. I tried to establish the connection via USB.
But i think that the issue is not connection itself, but rather the binding of the API in MATLAB.

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Matlab with PT104

Post by Hitesh » Tue Nov 22, 2016 9:37 am

Hi pt104user,

It looks as though you need to allocate some memory for the string details e.g.

Code: Select all

details = blanks(40);
serialLen = length(details);
If you e-mail support@picotech.com we can provide you with a basic example script.

Update: New example provided, but the prototype files in the 10.6.10 PicoSDK versions were generated using header files that use data types prior to our change in using data types defined in stdint.h which can lead to compatibility issues. Please e-mail support@picotech.com in the meantime if you require up-to-date files.

Regards,
Hitesh

Technical Support Engineer

Post Reply