Filter löschen
Filter löschen

i need to send a signal from one computer using matlab to another computer also running matlab through usb cable

8 Ansichten (letzte 30 Tage)
i need to send a signal from one computer using matlab to another computer also running matlab through usb cable

Antworten (2)

Gouri Chennuru
Gouri Chennuru am 13 Aug. 2020
Hi Esmail,
You can make use of the Data Acquisition toolbox available in MATLAB in order transfer the data using USB cable.
You can refer to these links for more information on how to acquire data from USB.
Hope this Helps!

Walter Roberson
Walter Roberson am 13 Aug. 2020
In the general case, this is going to be a problem.
USB is strictly a host / device ("master/slave") system. One of the two sides must be an active controller and the other must wait for commands. But you are trying to put PCs on both ends, and most PCs are not designed to be devices, only hosts.
There are specially designed devices such as smart phones that have hardware that can detect their role and automatically switch to device mode, but PCs seldom do that. There is part of the USB specification to permit negotiation of role; see https://stackoverflow.com/questions/11338076/how-usb-otg-worksmaster-slave
USB is not like RS232 or ethernet that is Peer-To-Peer.
If you are not connecting to hardware designed to automatically switch to device mode (like a smartphone) then you need to add a device that acts as a relay.
Such a relay would probably be implemented as Virtual COM port.
To use Virtual COM Ports, you need one of:
At the moment I do not know the major differences between serial() from basic MATLAB and serial() from Instrument Control Toolbox.
Note that USB 1.x and USB 2.x are limited to 1000 USB transactions per second; each transaction can transfer at most 1022 (I think it was) bytes of payload. I do not know if USB 3.x always has the same limitations.
Also, Virtual COM protocol is designed so that packets are not to be transmitted until one of:
  • packet is full; or
  • accumulation timeout; the timeout corresponds to about 40 Hz; or
  • the software requests that the driver "pushes" the packet. However, MATLAB does not provide any user-accessible way to request a push.
... Basically, if you need short latency or, response after sending less than about 1000 bytes, then USB is not an appropriate protocol.
By way of contrast, gigabit ethernet should in theory be able to handle about a million minimum-size packets per second, if I have estimated correctly. On a smal local LAN, gigabit ethernet should be able to reach more than 100 megabytes per second throughput for bulk transfers.
USB can be pretty convenient, but the covenience does lead to limitations that might or might not be of importance to you.

Kategorien

Mehr zu Digital Input and Output finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by