MATLAB: How to disable the “update links” prompt when using XLSREAD in MATLAB 7.0.4 (R14SP2)

excellinksMATLABmsgboxpopupupdatexlsread

I am trying to read an excel file using XLSREAD. However, MATLAB prompts me with the dialog asking whether to update the links. I do not want this prompt to come up every time I use XLSREAD. I would like to disable this prompt from MATLAB without using the "basic" mode.

Best Answer

You can open the workbook as a ActiveX server in MATLAB and set the "AskToUpdateLinks" property to '0' before using the XLSREAD or XLSWRITE functions to read or write to the workbook. The following example illustrates this procedure:
Excel = actxserver('Excel.Application');
set(Excel,'AskToUpdateLinks',0) % Prevents the pop-up.
Workbooks = Excel.Workbooks.Add('C:\Temp\Book1.xls');
% Saving with the 'AskToUpdateLinks' property set to 0 disables the pop-up.
Workbooks.SaveCopyAs('C:\Temp\Book1.xls');
Workbooks.Close(false);
% Since the pop-up has been disabled, you can write without invoking the pop-up.
A = [1 2; 3 4];
xlswrite('C:\Temp\Book1.xls',A,'A1:B2');