MATLAB Answers

How to save multiple Tables in Workspace with different names

조회 수: 3(최근 30일)
Felix Forrer
Felix Forrer 2021년 5월 9일
댓글: Felix Forrer 2021년 5월 9일
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 = {dinfo.name}
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)
end
  댓글 수: 5
Felix Forrer
Felix Forrer 2021년 5월 9일
Thank you very much this worked just fine!

댓글을 달려면 로그인하십시오.

답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by