Creating variables based on number of columns?

12 visualizaciones (últimos 30 días)
Nicholas DeGarmo
Nicholas DeGarmo el 13 de Abr. de 2020
Respondida: Steven Lord el 13 de Abr. de 2020
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.

Respuesta aceptada

Steven Lord
Steven Lord el 13 de Abr. de 2020
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.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by