Extracting data file in workspace from a table/files
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a folder (Measurement_1) of 120 data files in CSV format where each data file has the data of three sensors under name A, B, C). The final goal is to run the algorithm over each data file.
- I have started to import the data from the folder into matlab.
- Using the code
files = dir('*.csv');
tables = {};
for i = 1:length(files)
tables{i} = readtable(files(i).name);
end
I got three items in the work space
files 120x1 struct
i 120
tables 1x120 cell
Now, how can I extract the my 120 data recordings/files that are under different names such as
- sensors A, line_1
- sensor A, node_4
-sensor X, point_7X
.
.so on till 120
I am basic user of matlab, any help will be appreciated, many thanks.
0 Kommentare
Antworten (1)
Walter Roberson
am 15 Jul. 2020
The best thing is not to do that at all.
3 Kommentare
Walter Roberson
am 15 Jul. 2020
When you said,
Now, how can I extract the my 120 data recordings/files that are under different names such as
- sensors A, line_1
- sensor A, node_4
-sensor X, point_7X
are things like "sensors A, line_1" the file names? Or are they the names of columns? Perhaps "sensor A, line_1" and "sensor A, node_4" are intended to refer to the same file "sensor A.xlsx" and you want to extract variables "line_1" and "node_4" from those?? How is it determined what will need to be extracted?
When I read your question, I thought what you were asking was to create workspace variables named after the files, so the content of "sensor A, line_1" would be expected to be stored into a variable named something like "sensor_A_line_1" . That is the sort of practice that is discouraged: creating workspace variables named according ot data content is not a good idea. But now looking back, I realize I do not understand what it is that you actually want to do with the data once it is read in ??
Siehe auch
Kategorien
Mehr zu Tables 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!