i have loaded .xls file but only numeric values are only imported, character are not imported in it

9 Ansichten (letzte 30 Tage)
i have loaded .xls file but only numeric values are only imported, character are not imported in it

Antworten (1)

David Verrelli
David Verrelli am 21 Dez. 2017
Bearbeitet: Guillaume am 21 Dez. 2017
Hello, Pavithra.
You have not explained which method you used to "load" the ".xls" file, but I am guessing you might have used the xlsread command to open a Microsoft Excel spreadsheet, and furthermore that you used the syntax:
num = xlsread(filename)
As described in the documentation for xlsread, this will read "the first worksheet in the Microsoft® Excel® spreadsheet workbook named filename and returns the numeric data in a matrix." [emphasis added]
So, if that is the case, what you might want to try instead is the syntax:
[num, txt, raw] = xlsread(filename)
for which two additional variables are output from the function (or 'loaded' in your phrasing), namely txt and raw. The variable txt will contain the text fields in the form of a cell array, while raw will contain a mixture of numeric and text data, also in the form of a cell array.
—DIV
  1 Kommentar
Guillaume
Guillaume am 21 Dez. 2017
Note that since R2013b, a much better alternative to xlsread is readtable which will automatically recognise text, numbers, dates, and use column headers if present as variable names. It is also easier to use than xlsread.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by