Matlab cannot read string data
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2020-4-28
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.
回答(1 个)
Adam Danz
2020-4-28
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.
7 个评论
Walter Roberson
2020-4-29
dataExcel = readtable(fullfile(path,filename), 'sheetname', 'sheet1', 'range', 'A2:F50', 'readvariablenames', false);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!