Clear Filters
Clear Filters

import .txt files, convert into .xls and plot

12 views (last 30 days)
Laura Paletto
Laura Paletto on 6 Jul 2018
Answered: Nirav Sharda on 10 Jul 2018
Hi, I am quite new in matlab and I am not sure how to overcome this. I explain. I have a certain amount of .txt files (e.g. 400) that come out from a post-processing image spectroscopy. I'd like to import these into matlab, convert and save them as excel files and also plot them. I tried importdata and xlswrite but apparently I am doing something wrong as I cannot manage to convert into xls. Also, is it possible to import them all but then have them all within the same excel worksheet? Any suggestions? Thank you

Answers (1)

Nirav Sharda
Nirav Sharda on 10 Jul 2018
You can use ' readtable ' or ' textscan ' to read .txt files into a Table or Cell-Array. You can then use ' writetable ' to write it to Excel file. The 'writetable' function allows you to write to a specific sheet and range. You can utilize it to write data from all .txt file to one .xls sheet. I hope this helps.

Community Treasure Hunt

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

Start Hunting!