Loop Through Files to Import
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Anas Khan
am 10 Apr. 2021
Kommentiert: Anas Khan
am 11 Apr. 2021
I have data stored in files as seen in the screenshot attached. I want to create a script that will automatically access each file and load it into the workspace with the same name as the filename. I'll be using fopen() and fread() to access and read in each individual file. There are other file types in the folder that I do not want to import (the png and .m files). Any help would be appreciated.
2 Kommentare
Stephen23
am 11 Apr. 2021
I strongly recommend that you change your OS settings to show file extensions:
Otherwise working with files is confusing and more complex.
Akzeptierte Antwort
Jan
am 10 Apr. 2021
"with the same name as the filename" - This is a bad idea. Prefer to use either the same name or an array. Creating variables dynamically with names determined at runtime are a shot in your knee. See: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown 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!