write a row from excel to a text file
Show older comments
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 Comments
Stephen23
on 30 Mar 2021
"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
on 30 Mar 2021
"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
on 30 Mar 2021
Edited: Elysi Cochin
on 30 Mar 2021
Stephen23
on 30 Mar 2021
"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
on 30 Mar 2021
Stephen23
on 30 Mar 2021
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
on 30 Mar 2021
Accepted Answer
More Answers (0)
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!