필터 지우기
필터 지우기

fprint() to save uint8 in .txt file

조회 수: 11 (최근 30일)
benl23
benl23 2020년 4월 24일
답변: Athul Prakash 2020년 4월 27일
Hi all,
Thank you in advance for your help.
I've got a vector of uint8 numerica values ( from 0 to 255) that I would like to save in a .txt file.
I would need to have a .txt file in which each row is a single character. After having stored this .txt file in a SD card I would need to read it in Arduino whose file.read() function works reading one byte at a time.
I was thinking then that I would need to create a .txt file in which each row is the ASCII value correspondent to my uint8 number. Is there an easy way to do that using the fprint() function?
Do you have suggestions?
Thank you for your help!!

답변 (1개)

Athul Prakash
Athul Prakash 2020년 4월 27일
You may save it using the '%d' formatting operator and save it line by line to a text file. Use '\n' for moving to the next line.
Please see this doc and the examples in it to understand how to print your ascii values line by line.
In general, I have found the examples very useful in learning a new function or tool in matlab. Try picking out the first example in the doc.
Hope it Helps!

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by