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

151 次查看(过去 30 天)
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 ?

采纳的回答

Geoff Hayes
Geoff Hayes 2014-7-10
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by