refer to excel data using excel column numbers ?
Afficher commentaires plus anciens
I read in a large excel data file using readmatrix :
data = readmatrix('press.xlsx');
I would like to refer to the data by the original column names in excel - for example, for the third column, something like :
x = data(:,'C')
This runs but produces wrong results - Any way to make this work ? Thanks
Réponses (1)
Voss
le 14 Juil 2023
0 votes
Use readtable instead of readmatrix.
3 commentaires
Voss
le 15 Août 2023
@Ambady Suresh: Did this answer work for you?
Ambady Suresh
le 16 Août 2023
When data is a table, you would say:
x = data{:,'C'}
or:
x = data.C
Please see:
https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!