Matlab xlswrite error "Index exceeds matrix dimensions"

Folks,
Just trying to write a simple array to an excel file:
>>outputfile=('Test.xlsx');
>>A=[1 2 3];
>>xlswrite(outputfile,A);
And I keep getting this error message below
Index exceeds matrix dimensions.
Strange thing is if I use the exact same array and filename but change the extension to .csv and use csvwrite it works fine. Any thoughts on what I'm doing wrong? Currently running 2013b if that helps.
-Victor

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 8월 10일
편집: Azzi Abdelmalek 2015년 8월 10일
Check if xlswrite was not used as a variable.
Fix the problem:
clear xlswrite
outputfile='Test.xlsx';
A=[1 2 3];
xlswrite(outputfile,A);

댓글 수: 1

This works! Thank you very much...never occurred to me that I'd have to clear this out after trying so many times.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by