What exactly is the problem of DisplayAlerts?

I have the following code. It doesn't work when I press the run command. But it strangely works in the command prompt single-step debugging and what is even more strange to me is that it works in the 'Run and Advance' in the xlsread part without any error. I had faced this DisplayAlerts issue before too, and I used to work with it by just reading the file in the command prompt or working with the 'Run and Advance' thing. But out of curiosity I would like to know what exactly is the difference in either of the approach and why the simple run doesn't work but the 'Run and Advance' works. Thanks in advance.
clc
clear all
close all
[filename,pathname] = uigetfile('Open text file','MultiSelect','on');
%%
Excel = actxGetRunningServer('Excel.Application');
Excel.DisplayAlerts = false; % Avoid excel warning popups
data = xlsread(fullfile(pathname, filename))';
for i=2:1:size(data,1)
plot(data(1,:),data(i,:));
xlim([1e-3 1.4e-3])
xlabel('time')
ylabel('Voltage')
%title(sprintf('at Cc = %dpF',Cc));
hold on
end

댓글 수: 5

What error message do you get, or what behaviour indicates it is not working?
I am going to go out on a limb and speculate that you should put a brief pause() after the actxGetRunningServer call.
Jay Vaidya
Jay Vaidya 2020년 6월 29일
Thanks for the suggestion. This is what it looks.
Jay Vaidya
Jay Vaidya 2020년 6월 29일
Oh wow. It works. I never imagined that there is something called as xlsread1 too.
Btw why am I not having any option to choose 'Accept answer' to this question?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

질문:

2020년 6월 29일

답변:

2020년 6월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by