Reading an Excel table with both numbers and text
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aleem Andrew
am 5 Dez. 2021
Beantwortet: Adam Danz
am 5 Dez. 2021
I read an Excel table using the readtable function. I wanted to refer to specific values, whether text or numbers, but when I try to extract a specific value such as the value in column 4 and row 3 the output is not simply that string/number but also the heading. To solve this problem, I first used the table2array function but that lead to an error because the table has both text and numbers. An alternative is to read the table using the readmatrix function but the text is not readable in that case. Can anyone explain how the Excel table can be read as a matrix with both text and numbers so when you refer to the value in say column 4 and row 3 that returns only that value, not also the heading?
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 5 Dez. 2021
Use readtable which will read the data in as a table which is 2 dimentional but not a matrix. If you haven't used tables, you may want to review table indexing. This is usually better than using a cell array. Matrices are not an option if you want to store numeric and non-numeric data within the same variable.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!