write a row from excel to a text file
이전 댓글 표시
How can i write a string row ( not English ) from excel to notepad or wordpad. Is it possible in Matlab?
I have attached a sample excel sheet
댓글 수: 8
Stephen23
2021년 3월 30일
"How can i write a string row ( not English ) from excel to notepad or wordpad. Is it possible in Matlab?"
No: both notepad and wordpad are compiled binary applications, which cannot be "written to". Unless, of course, you want to destroy your application so that it cannot run anymore.
Or did you actually want to ask if you could write to a text file, which is a standard and very common file type (and which exists completely independently of any specific application)?
Elysi Cochin
2021년 3월 30일
"I tried the below code, but what got printed was some symbols."
Symbols is exactly what your file contains. The only two non-empty cells are these two:

These are the 30th and 31st letters of the Malayalam alphabet. I even went to the effort of checking them inside the XLSX file, here they are saved inside sharedStrings.xml:

Lets try Chris LaPierre's code and see what happens:
tbl = readtable("Book1.xlsx",'ReadVariableNames',false,"TextType","string");
writetable(tbl, "Book1.txt","WriteVariableNames",false,"Delimiter","\t");
str = fileread( "Book1.txt")
So far everything seems to be working exactly as expected. What specific problem do you have?
Note that some earlier MATLAB versions had only limited Unicode support: what MATLAB version are you using?
Elysi Cochin
2021년 3월 30일
편집: Elysi Cochin
2021년 3월 30일
Stephen23
2021년 3월 30일
"Two arrows (-> ->) are getting displayed in the text file for me"
What application (i.e. text editor) are you using to look at this file?
Elysi Cochin
2021년 3월 30일
Stephen23
2021년 3월 30일
I suspect that R2018a is unable to handle all Unicode correctly, but I have no way to check this. Perhaps Chris LaPierre can help further on clarifying this.
As an aside, I strongly recommend that you use a robust text editor, for example Notepad++.
Elysi Cochin
2021년 3월 30일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!