reading external data via lan or usb or others
6 次查看(过去 30 天)
显示 更早的评论
Hi everybody....I want to read outside world data by matlab , perhaps via LAN , USB, or anything else.How can I do that?
0 个评论
回答(3 个)
Image Analyst
2012-4-6
You might want to consider buying the Data Acquisition Toolbox.
3 个评论
Walter Roberson
2012-4-6
Instrument Control Toolbox is the toolbox that has the tcp and udp functions that would allow data to be read over a LAN.
Jason Ross
2012-4-6
What do you want to read the data from? A file on your LAN or USB stick? An instrument? A camera? What do you mean by "anything else"?
Walter Roberson
2012-4-6
Instrument Control Toolbox is the one for reading data from a LAN or remote instrument with internet capabilities.
Reading data from a parallel port is not recommended for new work. Parallel port access was deliberately made more difficult by Microsoft after Windows XP, and by the time of Windows 7 has to be done by nearly cheating on interfaces. Parallel port access will be removed in a future version of MATLAB.
Reading from a serial port is possible, provided that the device has a serial port to communicate with. Serial ports cannot be used to directly monitor voltage sources: serial ports require a specific protocol and specific timings. Parallel ports are more flexible in some ways, but still parallel ports cannot be used to directly monitor voltage levels other than in a "exceeds a particular standard voltage or it doesn't" sense.
The microphone input can be used to monitor voltage levels, provided that the voltage is in the range -0.447 V to +0.447 V relative to reference. If not then you may need to use amplifiers or resistors or voltage shift circuits to get the voltage in the right range, but those may introduce noise. You will almost certainly get clipping noise if your voltage is outside the above range.
The recommended approach for this kind of thing is to use an analog to digital convertor, possibly as a direct card in the computer. The Data Acquisition Toolbox is valuable if you use an A/D convertor.
With regard to USB: USB is a serial bus with a very specific protocol. There is no way to directly attach a voltage source to a USB port and measure the voltage levels. Some A/D convertors have USB interfaces; if you use such a device, then you must install the drivers for it, and the device must present itself as a "virtual serial device" and you would communicate with the device using serial port commands.
The only other realistic possibility with USB is if the device presents itself as a file system and offers what looks like a file, that contains a block of data when you "read" the file. This would not be common at all for an A/D convertor, but it can be worked with.
Ok, I guess a USB microphone could also be worked with, on the same basis as a microphone.
If all that you have now is the voltage source and for some reason you cannot get an A/D convertor, then microphone is all you can do.
1 个评论
Image Analyst
2012-4-6
I like using the MCC PMD-1024 (http://www.mathworks.com/products/daq/supportedio14004.html#USB) for doing things like detecting switch closures. It's a nice little USB device. They have USB devices that act as ADCs, measure temperature, and lots more.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 National Instruments Frame Grabbers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!