How to read multiple .txt files and store into multiple variables in Matlab

2 views (last 30 days)
Hi, I have 3 .txt files in a folder with different names such as "25Aug_CTD.txt", "26Aug_CTD.txt" and "27Aug_CTD.txt". Each of the .txt file is in this form (the values are different in each of the .txt file):
temp,salinity,trans
22.1,2.2,191
22.6,2.5,200
I'm trying to figure out how to store each of the numerical data from each of the .txt file into 3 different variables in Matlab. For example, the numerical data from "25Aug_CTD.txt" will be stored in the variable of 25Aug_CTD, numerical data from "26Aug_CTD.txt" will be stored in the variable of 26Aug_CTD and so on.

Answers (1)

Walter Roberson
Walter Roberson on 5 Nov 2015

Community Treasure Hunt

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

Start Hunting!