How can i convert excel file to .mat format and call to matlab code
조회 수: 34 (최근 30일)
이전 댓글 표시
I have an excel file named DAH,numeric file .How can i call that excel file to matlab code.Should i convert it to .mat format to call?
please find the below code
filename = 'DAH.xlsx';
a = xlsread(filename);
save(matfileName,'a');
x=a(:,1);
plot(x)
i am getting this error
Error using xlsread (line 136)
XLSREAD unable to open file 'DAH.xlsx'.
File 'C:\Users\Neethu Elizabeth\Downloads\DAH.xlsx' not found.
댓글 수: 1
Adam Danz
2020년 8월 22일
The xlsread function is a bit outdated. Consider replacing it with readtable, readmatrix, or readcell.
채택된 답변
Star Strider
2020년 8월 21일
댓글 수: 6
Star Strider
2020년 8월 22일
I cannot determine that because I do not know what the first column is. I also do not know what version/release of MATLAB you have.
One option, to be safe, is to to use the datenum function to convert the times to date numbers. Those values should plot correctly.
(A better approach would be to use datetime, and perhaps readtable or readmatrix instead of xlsread, however I do not know if you have those options.)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!