Excel Data import based on title cell.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Calum
am 21 Mär. 2023
Kommentiert: Calum
am 21 Mär. 2023
Hi folks, hope you are well.
I am wondering if anyone has a method of importing specific columns of data into MATLAB arrays based on the column title alone.
I am familiar with and have used the readvars/readtable functions extensively, however these have always required me to specify a range of column cells e.g. B:B for entire column B, C:C for entire column C etc. In my current work, I would like a method that reads column data straight from the excel sheet by locating this column by title alone, instead of me having to enter the sheet and find the specific letter column. E.g. if the column of data had a title 'Names' in cell C1, I would like the call to read and import all of the data in the C column, regardless of whether this was in C or another letter column entirely. The data I am working with has consistent title names in the '1' row, but columns are often in different orders - so any help with what I'm asking would be very efficient and help me massively.
Thanks!
C.
0 Kommentare
Akzeptierte Antwort
Vilém Frynta
am 21 Mär. 2023
After you read the table, you could simply search for the consistent names in your row. Then, you could specify which columns you are looking for, using those names.
For example, you could load all your data and then search the first row for a "Names", which would give you index (number) of that column. Then, you could use this index to load the whole column.
Does that make sense to you?
3 Kommentare
Vilém Frynta
am 21 Mär. 2023
Great solution as well! If your issue has been resolved, and you think my answer has helped you, I would be happy if you could formally accept it.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB 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!