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

199 views (last 30 days)
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 ?

Accepted Answer

Geoff Hayes
Geoff Hayes on 10 Jul 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 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!