Problems with reading an excel file contents with xlsread

I am trying to feed in data to excel via Matlab and perform calculations in the Excel environment using an add-in there and read back the calculated data in Matlab. Unfortunately, the Matlab is not reading the calculated values in Excel rather it just reads the data that I feed into it. I can post my simple test code below. If someone can help me with this it would be really grateful. Thank You
T1 = 538; %Turbine Inlet Temperature in Kelvin
P1 = 790000; %Turbine Inlet Pressure in Pascal
m = 0.2;
a = {'=PropsSI("H","P",A2,"T",A1,"water")'};
xlswrite('Test.xlsx',a,1,'A3')
B = [T1;P1];
xlswrite('Test.xlsx',B,1,'A1:A2');
opts = detectImportOptions('Test.xlsx')
A = readtable('Test.xlsx',opts);
C = xlsread('Test.xlsx','A1:A4');

3 Comments

It's most likely that your add-in doesn't get activated when matlab read/write to the file. Depending on how that add-in works, you could possibly work around that by talking to excel directly through atcxserver.
However, why don't you call the refprop/coolprop dll directly from matlab. It will be a lot faster than going through excel.
Dear Guillaume, First of all thank you for your kind reply. I will definitely look into the 'atcxserver'. And I actually don't know how to use refprop/coolprop with Matlab though I had followed the installation steps correctly said by their website. Also I couldn't find any tutorial for using refprop/coolprop with Matlab. It would be really nice again if you could help me on their usage in matlab directly. And it will reduce my problem complexity as you said. Thank You
Unfortunately, I'm not a user of refprop/coolprop so I'm probably not the right person to help you.

Sign in to comment.

Answers (0)

Asked:

on 15 Oct 2018

Commented:

on 15 Oct 2018

Community Treasure Hunt

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

Start Hunting!