I always get this error in different iteration values, sometimes in 43rd iteration, sometimes in 1251, but I can't figure out why.
Error using xlswrite (line 224)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Office has detected a problem with this file. To help protect your computer this file cannot be opened.
Help File: xlmain11.chm
Help Context ID: 0
Error in RelaySimulationWithChangingPower (line 66)
xlswrite('RelayDataTMS1',FLC1,1,['A' num2str(x)]);

답변 (1개)

Image Analyst
Image Analyst 2021년 6월 17일

0 개 추천

If you're calling xlswrite 1251 times, you're not doing it right -- that will take forever. It's better to use ActiveX. See attached demos.
It could be it's not done closing it from the prior operation. Or else you manually went to it and started doing something in Excel and it got confused. Or maybe there is something wrong with your x value or FLC1 array.

댓글 수: 2

Its my code block. Im working with simulink and m file. I want to make a xls file because then i will work on python for machine learning. And thats the xls file.
for ii= 1:2000 %% 10 iterations. 10 times power increased.
tic;
W=W+300;
L1=L1+100;
L2=L2+100;
L3=L3+100;
x=x+1;
y=y+1;
z=z+1;
set_param('UsingMATLABFunction/Source', 'Pref','W');
sim('UsingMATLABFunction.slx');
save_system('UsingMATLABFunction.slx');
xlswrite('RelayDataTMS1',FLC1,1,['A' num2str(x)]);
xlswrite('RelayDataTMS1',FltC1,1,['B' num2str(x)]);
xlswrite('RelayDataTMS1',OpTime1,1,['C' num2str(x)]);
xlswrite('RelayDataTMS1',TMS1,1,['D' num2str(x)]);
xlswrite('RelayDataTime1',FLC1,1,['A' num2str(x)]);
xlswrite('RelayDataTime1',FltC1,1,['B' num2str(x)]);
xlswrite('RelayDataTime1',TMS1,1,['C' num2str(x)]);
xlswrite('RelayDataTime1',OpTime1,1,['D' num2str(x)]);
Image Analyst
Image Analyst 2021년 6월 17일
What was x when it crashed? Did you try ActiveX yet?

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

카테고리

제품

릴리스

R2020a

질문:

2021년 6월 17일

댓글:

2021년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by