Creating variables based on number of columns?

2 次查看(过去 30 天)
So I have a project I am working on, and I have to import an excel sheet where the first column is just dates, and every column after that contains data with the first row containing the name of the data. How can I in my script create varibles for each column, and have it be expandable? Lets say I have to use a different data sheet that only have 5 columns instead of 8. What would be the best way to go about doing this? I also need to manipulate the data but I have no idea how to even assign the data to variables to manipulate it.

采纳的回答

Steven Lord
Steven Lord 2020-4-13
How can I in my script create varibles for each column, and have it be expandable?
CAN you do this? Yes. SHOULD you do this? NO.
Instead I recommend reading your data into a table or timetable array using either readtable (possibly calling table2timetable on the resulting table) or (if you're using release R2019a or later) readtimetable. There are a number of ways to access the data in a table or timetable, including selecting a set of rows in a range of times, for timetable arrays.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by