Matlab cannot read string data

조회 수: 9 (최근 30일)
joni nababan
joni nababan 2020년 4월 28일
댓글: joni nababan 2020년 4월 29일
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
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
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.
Try using readtable or readcell.
  댓글 수: 7
Walter Roberson
Walter Roberson 2020년 4월 29일
dataExcel = readtable(fullfile(path,filename), 'sheetname', 'sheet1', 'range', 'A2:F50', 'readvariablenames', false);
joni nababan
joni nababan 2020년 4월 29일
Hi, Walter
Thankyou somuch

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by