Am i using this command correctly?

I need to write a matrix into n excel file But after writing this:
filename = 'Transcript50students.xlsx';
xlswrite(filename,randi([60 100],50,3))
I get the following error:
Error using xlswrite (line 219)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Microsoft Excel cannot access the file 'C:\Program Files\MATLAB\R2016a\bin\37D40600'. There are
several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook.
Help File: xlmain11.chm
Help Context ID: 0
Any help ? I think i am doing it correctly.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 9월 7일

1 개 추천

You either need to cd to a different directory or else you need to specify a complete pathname for the file. Your current directory is underneath the MATLAB installation directory, and MS Windows UAC (User Access Control) does not allow non-privileged users to write there.

댓글 수: 2

Orlando Batista
Orlando Batista 2016년 9월 8일
That fixed it! Thank you so much!
Walter Roberson
Walter Roberson 2016년 9월 8일
Please mark the Answer as Accepted.

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

카테고리

태그

질문:

2016년 9월 7일

댓글:

2016년 9월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by