Reading column vectors from table with header text as variable name
I have an excel file with first row as header name for the corresponding column, each column has 4999 entries and 85 different readings. I want to load all the column vectors as a seperate variable. The variable name should be same as the header name from the excel file.
T = readtable("sample_data.csv");
S = T.Properties.VariableNames;
for i = 1:length(S)
assignin("base", S{i}, T.(S{i}))
end
This is what I came up with, but someone suggested not to use assignin command. Can some one suggest better alternative to this, also I don’t want to seperate the column vectors manually.
Thank you.I have an excel file with first row as header name for the corresponding column, each column has 4999 entries and 85 different readings. I want to load all the column vectors as a seperate variable. The variable name should be same as the header name from the excel file.
T = readtable("sample_data.csv");
S = T.Properties.VariableNames;
for i = 1:length(S)
assignin("base", S{i}, T.(S{i}))
end
This is what I came up with, but someone suggested not to use assignin command. Can some one suggest better alternative to this, also I don’t want to seperate the column vectors manually.
Thank you. I have an excel file with first row as header name for the corresponding column, each column has 4999 entries and 85 different readings. I want to load all the column vectors as a seperate variable. The variable name should be same as the header name from the excel file.
T = readtable("sample_data.csv");
S = T.Properties.VariableNames;
for i = 1:length(S)
assignin("base", S{i}, T.(S{i}))
end
This is what I came up with, but someone suggested not to use assignin command. Can some one suggest better alternative to this, also I don’t want to seperate the column vectors manually.
Thank you. importing excel data, variables, text file, solve MATLAB Answers — New Questions