Matlab cannot read string data

10 vues (au cours des 30 derniers jours)
joni nababan
joni nababan le 28 Avr 2020
Commenté : joni nababan le 29 Avr 2020
Hi everyone,
please help me,
i have a xls file with 6 column. First column is string type and others are numeric. i don't know why i cant read the first column data with 'xlsread'. maybe because it is string. is there any way to read my first column?
Thankyou
  1 commentaire
Star Strider
Star Strider le 28 Avr 2020
The xlsread funciton has three possible outputs. The first is numeric data, the second is character data, and the third is a cell array of everything in the file. Return all the outputs, then experiment with how best to extract the non-numeric data you want.

Connectez-vous pour commenter.

Réponses (1)

Adam Danz
Adam Danz le 28 Avr 2020
Straight out of the documentation
num = xlsread(filename) reads the first worksheet in the Microsoft® Excel® spreadsheet workbook named filename and returns the numeric data in a matrix.
Try using readtable or readcell.
  7 commentaires
Walter Roberson
Walter Roberson le 29 Avr 2020
dataExcel = readtable(fullfile(path,filename), 'sheetname', 'sheet1', 'range', 'A2:F50', 'readvariablenames', false);
joni nababan
joni nababan le 29 Avr 2020
Hi, Walter
Thankyou somuch

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by