MATLAB: Reading real time data from Excel 365 to MATLAB 2018a

automationcom server

Hi,
I am having problem while reading real time data from Excel 365 to MATLAB. somebody please help. How to do read real time data from excel to MATLAB ?
Thanks in Advance.

Best Answer

I was using COM server for Automation, but wasn't getting real time data on MATLAB from excel. I did use actxserver to connect to excel.
exl = actxserver('excel.application');
exlWkbk = exl.Workbooks;
exlFile = exlWkbk.Open(['C:\Users\Amarkant\Desktop\ExcelToMatlab_COM\Indices_rtd.xlsx']);
exlSheet1 = exlFile.Sheets.Item('Sheet1');
robj = exlSheet1.Columns.End(4); % Find the end of the column
numrows = robj.row; % And determine what row it is
dat_range = ['A1:B' num2str(numrows)]; % Read to the last row
rngObj = exlSheet1.Range(dat_range);
exlData = rngObj.Value;
data is changing on excel but I am not getting updated data on variable "exlData". This is the problem I am facing, I wanted to manipulate rtd from excel into MATLAB.
I am very new to COM Automation server.
please help. Thanks in Advance.
Related Question