Trying to open/read a .xlsx file in MATLAB

조회 수: 61 (최근 30일)
Athena Harris
Athena Harris 2022년 1월 4일
댓글: Star Strider 2022년 1월 4일
I'm trying to read an excel file in MATLAB and have the content displayed in the command window my current code is:
PlayerAstatistics = xlsread('Player A Statistics.xlsx');
type PlayerAstatistics
I've replaced 'xlsread' with 'fopen' 'readtable' and 'readmatrix' but I keep getting the same error message:
Error using type
File 'PlayerAstatistics' not found.
The file is shown in both the 'Current folder' and 'Workspace' tabs.
What am I missing or doing wrong to get this error?
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2022년 1월 4일
hello
are you sure the filename syntax is correct (blanks ? )
'Player A Statistics.xlsx' or 'PlayerAStatistics.xlsx' ??

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

채택된 답변

Star Strider
Star Strider 2022년 1월 4일
The type function will display the contents of a file.
The disp function (or simply removing the trailing semicolon from the xlsread call) will likely produce the desired result.
Also, since you are using R2020a, the readmatrix or readtable functions might be more appropriate than xlsread.
.
  댓글 수: 2
Athena Harris
Athena Harris 2022년 1월 4일
Thank you for the information, it's now working as desired
Star Strider
Star Strider 2022년 1월 4일
As always, my pleasure!
.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by