How do I stop this xlswrite error message?

조회 수: 14 (최근 30일)
Cg Gc
Cg Gc 2019년 4월 5일
댓글: rahul 2024년 10월 14일
I am writing a series of values to an excel sheet to do some quick comparisons with other data. Each value is a single number. Ex. caseyJan1992 = 52.6
This is my code for one of them.
xlswrite('casey_Hourly_443610_tp.xlsx',caseyJan1992,'MonthlySums','b14');
It is basically putting a single value into a one cell of a spreadsheet called "MonthlySums'. There are a bunch of these values going into spread sheet.
When I first open up MATLAB and run the code, it works fine. But, if I let MATLAB stay open for a few minutes or try to run the script more than once, I get this error message.
Error using xlswrite (line 224)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: This command is unavailable because the license to use
this application has expired.
Help File: xlmain11.chm
Help Context ID:
My fix is to simply save my work and restart MATLAB.
This fix works, but it isn't a permanent solution and it takes more time away from what I need to do. Does anyone know of a more permanent solution?
  댓글 수: 7
Guillaume
Guillaume 2019년 4월 8일
As far as I understand writetable still use Excel by default (on Windows with Excel installed). It's only if you specify 'UseExcel', false that you don't need excel.
Walter Roberson
Walter Roberson 2019년 4월 8일
Good point about the (fairly new) UseExcel parameter.

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

답변 (2개)

Javier Anguiano
Javier Anguiano 2021년 9월 19일
I found that changinig the working directory to a short name solve the problem. I suppose that it's something related to the number of characters on the name and destiny of the final output. In my case, I set my working directory to C:/ and It works fine. The final destination/name of the file is not up to 20 characters.
  댓글 수: 1
rahul
rahul 2024년 10월 14일
I found even that was also not working .

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


Jan
Jan 2019년 4월 5일
It is not enough to think, that the license is active. Start Excel and check the license:
  댓글 수: 8
Jan
Jan 2019년 4월 9일
@Cg Gc: Although you do not care about Guillaume's advice to black the personal information on the screenshots, I've edited them now. Do not post personal details like email address or GUIDs of your accounts.
Thanks for posting the screenshots. Now it is at least clear, which Office version you are using. Maybe this helps to check the license then:
It is not clear, if this is a Matlab problem, because it seems to concern the Office license only. Does using the debugger to step line by line through the code of xlswrite reveal which test is actually failing?
Cg Gc
Cg Gc 2019년 4월 9일
This line worked, without the extra space. I have no idea what it did, but the expired license error message takes longer to appear. I can now create 2 or sometimes even 3 spreadsheets before it breaks. So, I guess that is a good thing.
excel = actxserver('Excel.Application');

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by