How to read a string data from excel sheet ? Or to read a single row having charaters

175 visualizzazioni (ultimi 30 giorni)
I want to read an excel sheet . 1st row all variable names 2: N th row all data
I just want to read the 1st row . Is that possible I have used "dataimport" function , but reads that entire excel sheet ! Is there a way to just read a single row from excel sheet ?

Risposta accettata

Geoff Hayes
Geoff Hayes il 10 Lug 2014
Consider using xlsread. See xlsread for details and pay particular attention to the use of the xlRange input to this function. If you know the number of columns in the file then you could do something like
[~,txtData] = xlsread('cycling.xlsx','A1:H1')
In the above, we ignore (using ~) the first output parameter which corresponds to numeric data, and instead concentrate on the text data which is returned as a cell array of strings. We use the range 'A1:H1' to return the data in the first row for columns A through H.
Try the above and see what happens!
  3 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Import from MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by