MATLAB Answers

How to save multiple Tables in Workspace with different names

4 views (last 30 days)
Felix Forrer
Felix Forrer on 9 May 2021
Commented: Felix Forrer on 9 May 2021
First of all I know i should not be doing this as every answer ist something like "you should use indexing" but i need it.
So, i got hundreds of tables with over 100'000 rows of data in 37 Variables and i have to import them (.csv files) into matlab. I wanted to use a for loop to do this. As the question stated i am not able to get the table saved into my workspace as the table name is not dynamically. Is there any good solution for this? I am not a programmer and i do not have much experience with matlab. What i try is to geht the names for the tables out of "name_cell" and change the "messungen" dynamically with the names i extract from there in some way. I just cannot get this code run. Appreciate every bit of help.
Here is the code i wrote so far:
dinfo = dir('/MATLAB Drive/Nur motor');
names_cell = {}
for i = 3:length(names_cell)
opts = detectImportOptions(names_cell{i});
opts.VariableNamesLine = 11;
opts.DataLines = [12 Inf];
messungen = readtable(names_cell{i},opts);
varname = names_cell{i}
varname = varname(1:end-4)

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!