Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 2 ratings Rate this file 20 Downloads (last 30 days) File Size: 17 KB File ID: #25100 Version: 1.8




21 Aug 2009 (Updated )

Setup and run EPANET simulations in Matlab

| Watch this File

File Information

*** NEW (October 2013) Try the EPANET-Matlab Class at ***

*** The version below will no longer be supported ***

Thank you,


This is an extension of the getwdsdata.m originally created by Philip Jonkergouw in 2007.

It captures most of the commands allowed by EPANET, and effort was given to be as generic as possible.

*** You need to add the EPANET.DLL file in the folder for this to work properly - you can download it from the EPA website: ***

*** There seems to be an bug in setdata.m. To solve this use

[errorcode]=calllib('epanet2','ENsetcontrol', ControlIndex, ControlType, LinkIndex, Setting, NodeINdex, Level)

Details on the parameters can be found in the toolkit.chm file, section ENsetcontrol. ***


Getwdsdata.M inspired this file.

This file inspired Epanet Info From Inp Files.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
05 Oct 2014 Demetrios Eliades

@Karwan Ali: you need to run

>>mex -setup

and select a compiler (e.g. Microsoft Windows SDK 7.1)

Have a look at this link:

Comment only
04 Oct 2014 Karwan Ali

Please,I have the following error, what does it means?. Thank you

Error using loadlibrary (line 254)
A 'Selected' compiler was not found. You may need to run mex -setup.

Error in epanetloadfile (line 3)

Comment only
27 Jun 2013 Chris Kelley

Thank you for this tool. I've noticed that the full hydraulic analysis report output by the toolkit (set with ENsetstatusreport(2)) seems to be very different from the full report output by EPANET (in Report >> Full...). Is there an easy way to get all the data in the EPANET full report via this toolkit?

Your advice is greatly appreciated.


Comment only
23 Nov 2012 Mesanlibor

i want to use optimization also here, i want to keep the elevation of the nodes and the diameter of the pipes as variables in the input file. How can i do it?

Comment only
15 May 2012 jinseok

can you tell me how to install this file?

Comment only
07 Mar 2011 david

david (view profile)

fantastic tool!

17 Jan 2010 Kegong Diao

Thanks a lot!

22 Oct 2010 1.1

Philip Jonkergouw is now properly acknowledged!

25 Oct 2010 1.4

Removed epanet.dll file

25 Nov 2010 1.5

1. Added instructions on how to run the example by downloading EPANET.DLL
2. Changed the copyright file

29 Jun 2011 1.6

Notify for a bug in setdata.m, regarding control modification

15 Oct 2013 1.8

Change in the description

Contact us