How can I solve the error of Aspen Hysys case opening "Invoke Error, Dispatch Exception: Access is denied."

32 views (last 30 days)
I am using MATLAB 2016a and Aspen HYSYS V9. I am trying to connect between two program and encounter the error as following:
>> hysys=actxserver('Hysys.Application')
hysys =
>> simcase=hysys.SimulationCases.Open([cd,'\an.hsc']);
Error using Interface.HYSYS_9_Type_Library.SimulationCases/Open
Invoke Error, Dispatch Exception: Access is denied.
I tried to run MATLAB as Administrator but the result was still the same. I put the an.hsc file in MATLAB path.
Please kindly help me solve this error. Thank you very much for your help.
Zain Javed
Zain Javed on 26 May 2020
Hi! If you get your answer so please help the people like me so we can make this world a better place with our projects.
Hossein Hanzali
Hossein Hanzali on 8 Dec 2023
I have the same problem, the .m file and .hsc files are in the same folder. I tried a lot but not solved. please return the answer to me if the problem solved

Sign in to comment.

Answers (3)

Rasel Ahmed
Rasel Ahmed on 26 Aug 2020
Put both files, Hysys simulation case (.hsc) & the following matlab script (.m) in the same folder. Matlab Code, please modify simulation name ("Distill_Example.hsc") accondingly:
Hysys=actxserver('Hysys.Application.V10.0'); %COM Technology
[stat,mess]=fileattrib; %getting actual folder name
simcase = Hysys.SimulationCases.Open([mess.Name '\Distill_Example.hsc']); %Opening HYSYS Simulation (Distill_Example.hsc)
simcase.invoke('Activate'); %Opening HYSYS Simulation (Distill_Example.hsc)
Typically, "Error using interface" can be generated due to lack of Hysys License, therefore the program cannot initialize.
If the error persists, you can send me the simulation and I will try to make the Matlab-Sim Hysys connection.
Andrés Abril
for details discussion, please follow this link.

Francesco Catena
Francesco Catena on 28 Sep 2022
The .m file and the .hsc file have to be in the same folder. Then you can proceed as follow:
Hysys = actxserver('Hysys.Application.V11.0');
FileNamePath = 'File_name';
Simulation = Hysys.SimulationCases.Open([cd,strcat('\',FileNamePath,'.hsc')]);
Simulation.Visible = true;
Components = Simulation.Flowsheet.Operations;
Streams = Simulation.Flowsheet.MaterialStreams;
Fluxes = Simulation.Flowsheet.EnergyStreams;
Best regards,

on 20 Nov 2023
Same Folder is solution


Find more on Startup and Shutdown in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!