Effacer les filtres
Effacer les filtres

Creating variables based on number of columns?

5 vues (au cours des 30 derniers jours)
Nicholas DeGarmo
Nicholas DeGarmo le 13 Avr 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.

Réponse acceptée

Steven Lord
Steven Lord le 13 Avr 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.

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by