converting txt to xlsx

4 vues (au cours des 30 derniers jours)
gmltn1212
gmltn1212 le 16 Juil 2020
Commenté : Tim Koopman le 16 Juil 2020
Hi I am trying to convert a textfile to xlsx. file
My textfile holds this information:
StudentName: James
School: University of Blah
Year: 2020
Grade: 3
Pin: 40
And I want to convert this to xlsx. file
*check the attached screenshot file*

Réponse acceptée

Tim Koopman
Tim Koopman le 16 Juil 2020
This will convert the full text file to .xlsx:
yourFileName = readcell('yourFileName.txt')
writecell(yourFileName,'yourFileName.xlsx')
If you only want to save the second column, like in your screenshot, use this:
yourFileName = readcell('yourFileName.txt')
writecell(yourFileName(:,2),'yourFileName.xlsx')
  2 commentaires
gmltn1212
gmltn1212 le 16 Juil 2020
does readcell() function work on text files?
Tim Koopman
Tim Koopman le 16 Juil 2020
Yes it does

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by