text file trasfer using UART

조회 수: 4 (최근 30일)
Hitu
Hitu 2013년 12월 20일
댓글: Walter Roberson 2013년 12월 24일
I making a GUI in which I have inserted a push button to transfer the .txt file using UART.I have designed the transmitter for the UART which is working fine.I now I am intended to transfer a text file using UART TX to UART RX.KIndly suggest the function in matlab which can help me to implement the file transfer in .txt format.

답변 (2개)

Walter Roberson
Walter Roberson 2013년 12월 20일
fwrite(s, fileread('YourFile.txt'))

Hitu
Hitu 2013년 12월 23일
Thanks But how it'll reach the file location.As in where to save the text file so as to access the same using above function.
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 12월 24일
If you already have the data in memory, then why not send it directly instead of writing it to a file first??
The fileread() part of the above call is to get the file into memory as a single string. If you already have that, then just fwrite() the string instead of storing it?
"Q: A mathematician has a glass of water on a desk, a book of matches, and a piece of paper in a waste basket. The piece of paper in the basket starts on fire. What does the mathematician do?
A: The mathematician, thinking quickly, throws the glass of water on the fire, thus putting it out.
Q: A mathematician has a glass of water on a desk, a book of matches, and a piece of paper in a waste basket. The piece of paper in the basket is not on fire. What does the mathematician do?
A: The mathematician lights the piece of paper in the wastebasket, and leaves it to burn, having reduced the problem to one that has already been solved."

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by