Writing to USB with MATLAB using CyUSB.dll

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hello,

   

I would like to use MATLAB to send and receive Data via USB to my PSoC5. Has anyone of you some experiences to do this and can help me perhaps with some example-code?

   

What I did until now is the following:

   

- Add CyUSB.dll as an assembly to matlab:

   

 try

   

  CyUSBdll = NET.addAssembly('C:\Cypress\.. .. .. \CyUSB.dll');

   

  catch e

   

    e.message

   

    if(isa(e, 'NET.NetException')

   

      e.ExceptionObject

   

    end

   

else

   

  disp('CyUSB.dll already loaded');

   

  return;

   

end

   

 

   

- Get USB-Device list

   

usbDevices = CyUSB.USBDeviceList(CyUSB.CyConst.DEVICES_CYUSB);

   

 

   

Now, my problem is to get the right instance of the device. my tests like

   

  myDevice = usbDevices.Item('ITEMNAME');

   

failed. It returns an empty variable (ans = []).

   

Has anyone of you an idea how to get this?

   

 

   

Kind regards,

   

Felix

0 Likes
5 Replies
Anonymous
Not applicable

 Please post this question in the PSoC forums. That would be the best place to get your answers for this particular question.

0 Likes
Anonymous
Not applicable

 Hi

   

Has anyone figured this one out yet? I am glad I am not the only trying to use CyUSB.dll in Matlab, however several people posted this exact problem and no solutions. I have searched and searched but  I think .NET library CyUSB.dll is not usable with Matlab. This indexing thing does not work out at all. 

   

Could someone perhaps explain how I can stream data from the device to PC? My intention is to 

   

1. connect to device (EZ-USB FX2)

   

2. request data

   

3. plot data as it comes in

   

4. and save it to text file

   

Matlab was the best choice as it could do all 4 (I thought) but stuck at 1.

0 Likes
Anonymous
Not applicable

Hi ,locsong

   

have you found a suitable solution to stream data from the device to pc ?

   

can you help me plz

   

thanks

0 Likes
Anonymous
Not applicable

Hi 

   

can someone help me resolving the same problem

   

locsong have you found a suitable solution to stream data from the device to pc ?

   

thanks

0 Likes
Anonymous
Not applicable

Do you guys really want to use USB to transfer data into MATLAB or just PC in general?

0 Likes