I need to take the data of more than 100 excel files. I have managed to obtain the name of each one of the files but when I use readmatrix it gives me an error.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clear all;
clear; %With these code I can create the names of all the files who have a
clc; %similar name to the file I posted. But when i try to use readmatrix
stations= ["C042","C057","C061","C067"]; %using the variable filename, it says that filename doesn't exist.
parameters=["AirTemp","Precipitation","WindSpeed"]; %I would appreciate your help.
for station=stations %Thanks
for parameter=parameters
for month=01:12
filename=sprintf("%s_%s_2021%02d.csv",station,parameter,month)
data= readmatrix("PROJECT\PROJECTDATA\'filename'")
end
end
end
2 Kommentare
Antworten (1)
Frantisek Gaspar
am 26 Nov. 2022
For reading tabular data I recomend readtable function. The function can be set to handle various files and is quite robust. If there are multiple files I alos recoment datastore function which can make the loading more convenient,
0 Kommentare
Siehe auch
Kategorien
Mehr zu Text Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!