Why Struct contents reference from a non-struct array object occurs?
Afficher commentaires plus anciens
I'm new to MatLab. Trying to connect MatLab and Unisim Design.
load('p_rez','p');
N=12;
M=1679616;
h=actxserver('UniSimDesign.application');
fl=h.ActiveDocument.Flowsheet;
flow=fl.MaterialStreams;
N2=flow.Item('Nitrogen');
CO2=flow.Item('CO2');
H2S=flow.Item('H2S');
Methane=flow.Item('Methane');
Ethane=flow.Item('Ethane');
Propane=flow.Item('Propane');
IButane=flow.Item('i-Butane');
NButane=flow.Item('n-Butane');
IPentane=flow.Item('i-Pentane');
NPentane=flow.Item('n-Pentane');
Feed=flow.Item('Feed');
for i=1:M
N2.MassFlowValue=p(i,1)/3600;
CO2.MassFlowValue=p(i,2)/3600;
H2S.MassFlowValue=p(i,3)/3600;
Methane.MassFlowValue=p(i,4)/3600;
Ethane.MassFlowValue=p(i,5)/3600;
Propane.MassFlowValue=p(i,6)/3600;
IButane.MassFlowValue=p(i,7)/3600;
NButane.MassFlowValue=p(i,8)/3600;
IPentane.MassFlowValue=p(i,9)/3600;
NPentane.MassFlowValue=p(i,10)/3600;
Feed.PressureValue=p(i,11);
Feed.TemperatureValue=p(i,12);
VP(i)=Feed.VapourFractionValue;
end
save('VP_Rez','VP');
and here is an error
"Struct contents reference from a non-struct array object.
Error in FromUS (line 6)
fl=h.ActiveDocument.Flowsheet;"
What am I doing wrong?
3 commentaires
Walter Roberson
le 8 Juin 2020
What happens if h.ActiveDocument is empty ? You do not appear to be telling UniSimDesign to load or open anything; it might not happen to have anything active.
Elina K
le 8 Juin 2020
Walter Roberson
le 8 Juin 2020
It looks like you would use h.GetObject() to load an existing case such as is shown near the bottom of the page I-9 at https://sites.ualberta.ca/CMENG/che312/F06ChE416/HysysDocs/AspenHYSYSCustomizationGuide.pdf
Réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!