Clear Filters
Clear Filters

How can I import multiple text files by clicking a button in MATLAB GUI ?

2 views (last 30 days)
Hello, everyone!
I have to import all the text files in a folder by clicking a button in MATLAB GUI. The file contains mixed data: Text in the starting lines, followed by columns headers and data in which first 2 columns are date and time and the remaining data contains float values). I am unable to do it. Please help me out.
Thank you.
  2 Comments
KSSV
KSSV on 24 Mar 2017
There are functions like importdata, testread, textscan to read text files. Have you read those?
Mora Akhil
Mora Akhil on 24 Mar 2017
Hello KSSV! I have gone through those functions. I can read a single text file of such kind using only programming. My problem is, I am unable to import text files in a folder in GUI.

Sign in to comment.

Answers (1)

Nagini Venkata Krishna Kumari Palem
In my understanding you are looking for solution to read text files of different formats. You can use 'uiimport' command from command window or use 'import data' option from home tab.
  • Customize the format of imported data and variable names as required using the relevant options in import tool.
  • Click on the drop-down menu under 'Import Selection' and select 'Generate Script'.
  • Using the generated script, you can import data from other files in the same format, all you have to do is change the filename.
For more information you can refer to the following documentation pages,
If you are looking for how to import all the files from a folder, one possible solution would be to iterate through all the files in a loop.

Categories

Find more on MATLAB Report Generator 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!