reading external data via lan or usb or others
조회 수: 4 (최근 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에서 Data Acquisition Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!