linking SWMM5 GUI to MATLAB

Hi every body

I want to design urban drainage system using optimization technique. Decision variable is for example ( pipe diameter).  My optimization code develops in MATLAB. How can I link MATLAB with SWMM5 so that in each iteration pipe diameters are chosen and SWMM is run. Objective function are then  determined and next iteration will be started  the same as previous iteration.

I have a question about above mentioned problem:

Can I link MATLAB with SWMM5 GUI or not? If yes, How?

If no, is there another way to link? please tell me about that.

(It should be noted that I have prepared my urban drainage system using SWMM5 GUI).

You need to be a member of SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA) to add comments!

Join SWMM 5 or SWMM or EPASWMM - (not formally associated with EPA)

Email me when people reply –


  • Now, it makes sense, thanks for the rpt file.  It turns out that the RPT file detailed printout is only made if you do NOT make the OUT file.  Try just making a RPT  file in your call from MATLAB.

    swmm5.exe D:\swmm5.0.022\urban.inp D:\swmm5.0.022\urban.rpt

  • Yes I have but I cant translate or change the rpr file in a way I can see the results.
    • Bob, Attached are the output and report files. One of them contains the status report, but I cant see what is in the other one.


    • Can you attach your rpt file, I don't understand why you do not see any results in the rpt file using MATLAB.

  • Yes I have.

  • Actually I give it a name (dos('swmm5.exe 3-3.inp 3-3.rpt 3-3.out')). The problem is that when I click on 3-3.rpt to open it, a window with the name of Report Explorer Report 3-3.rpt is appeared in which I cant find any data like you mentioned.

    • Do you have a REPORT Section in your input file?

      INPUT NO

  • The file swmm5.exe is the same as the DOS console executable I was mentioning, console is just one of the ways you compile SWMM5 in Visual Studio.  If you give the rpt file a name and directory you should be able to find it in Matlab - i think if you do not give it a name it uses a tmp file name

    Here is an example DOS batch file, maybe you can use a similar inp, rpt and out file structure in MATLAB

    swmm5.exe D:\swmm5.0.022\urban.inp D:\swmm5.0.022\urban.rpt D:\swmm5.0.022\urban.out

  • Thanks for your reply Bob. I usually link swmm with matlab using 'swmm5.exe", and a report file is created after simulation, but I cant open it. You mentioned DOS console version of SWMM 5; I dont know how I can create or where I can find it.

This reply was deleted.