MATLAB: Matlab xlswrite error “Index exceeds matrix dimensions”

xlswrite error

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

Best Answer

Check if xlswrite was not used as a variable.
Fix the problem:
clear xlswrite
outputfile='Test.xlsx';
A=[1 2 3];
xlswrite(outputfile,A);
Related Question