Welcome to WEAP's Website WEAP
WEAP is an initiative of the Stockholm Environment Institute.

About WEAP

What's New?
Sample Screens
History and Credits

Using WEAP
User Guide
Videos (YouTube)

User Forum
Members List
Edit Profile

Additional Support
University Courses

About Us
SEI-US Water Resources Program
Please Contact Us

Environmental News
Heat from below: How the ocean is wearing down the Arctic sea ice
The influx of warmer water masses from the North Atlantic into the European marginal seas plays a significant role in th...

Research reveals why people pick certain campsites
Those in love with the outdoors can spend their entire lives chasing that perfect campsite. New research suggests what t...

Climate conditions during the migration of Homo sapiens out of Africa...
Climate reconstruction of the last 200,000 years from East Africa illustrates the living conditions of Homo sapiens when...
Source: Science Daily
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!

User Forum

All Topics | Topic "Weap automating with Matlab"
Log in to post new messages or reply to existing messages.
Author Message
Mr. Mostafa Khorsandi

Subject: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 29886 times
Does anyone know how can I automate weap with Matlab without problem?
It works very well with VB but have problems with matlab
Mr. Jack Sieber

Subject: Re: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 29885 times
I do not have any experience with Matlab and WEAP. Do you want to write a Matlab script to control WEAP, or write a script in WEAP to control Matlab?
Mr. Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 4/20/2012 Viewed: 29882 times
I want to write a Matlab script to control WEAP
Dr. Mehdi Mirzaee

Subject: Re: Weap automating with Matlab   
Posted: 4/27/2012 Viewed: 29827 times
Hi Mostafa,

It is possible. when you can write VB and interact it with WEAP, means that you can connect MATLAB with WEAP, but there is a small problem! Are you trying to make an .exe file? So, are you sure that your MATLAB is not hacked one?
Honestly, some hacked MATLAB versions can not make execution files and sometimes shows a non sense error or message.

Eng. Alberto Vivas Narváez

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 29529 times
Hi Mostafa:

In programming (VB) there are many things you can do but you should never forget the goal. What questions need to answer through link-WEAP MatLab?

You can use MATLAB in a wide range of Applications, Including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology


Mr. Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 29519 times
I want to optimize some parameters in weap by genetic algorithm (GA) or NSGA that exist in MATLAB, ...
and I'm not trying to write an .exe file to do this

writing an .exe file for this is a new idea that I didn't think about it
but maybe it can work.
if possible say me what is your way to link by means of an .exe file?

best regards
Dr. Mehdi Mirzaee

Subject: Re: Weap automating with Matlab   
Posted: 5/31/2012 Viewed: 29514 times

Well... Honestly I am not a Pro. programmer!just have a little things about MATLAB.

Anyway, I think that you have two or three ways. The first one is writing a .dll file, then call them in WEAP by "Enter Expression". It is the easiest way.

The second way is that you prepare a platform for everything which it can be a VBA platform (like Excel). you can run and call everything that you want by VBA expressions, like .dll or .exe file.
in this manner, if you are a software pro or you have some one to have "HEADACHE" for writing software, you can check this website:


you can write and then run a plat form of different software and link them each other. This is in a part of Deltares (Former Delft Hydraulics) website. Unfortunately, as I told you, I am not a programmer and old for learning it! :)

Have fun!
Eng. Ioannis Tsoukalas

Subject: Re: Weap automating with Matlab   
Posted: 11/30/2012 Viewed: 28535 times
i try to couple weap and matlab via COM and i have a similar problem.. here is 2 lines of matlab scritping

W=actxserver('WEAP.WEAPApplication') %%to make the coupling

W.Branch('\Demand Sites\South City').Variable('Consumption').Expression=30 %%to define the consumption

but in weap i get the logical value "True" does anyone know how can i make it work?
Mr. Mostafa Khorsandi

Subject: Re: Weap automating with Matlab   
Posted: 11/30/2012 Viewed: 28528 times
Hi Ioannis:
Unfortunately we couldn't solve this problem and our plan has been changed
but, if there is no obligation to do by Matlab, it is better to do by visual basic

Mr. behzad jamali

Subject: Re: Weap automating with Matlab   
Posted: 6/12/2013 Viewed: 26285 times
Hi Ioannis
did you solve the logical value "True" problem in data expression? I have te same problem, too.
i wonder if you can tell me about your experiences in weap automating With Matlab and its optimization algorithms.
Mr. Jack Sieber

Subject: Re: Weap automating with Matlab   
Posted: 9/9/2015 Viewed: 17340 times

Congratulations on your recent conference paper, "Hydrosystem Optimization on a Budget: Investigating the Potential of Surrogate Based Optimization Techniques", http://cest.gnest.org/cest15proceedings/public_html/papers/cest2015_00162_oral_paper.pdf . It appears that you were able to couple WEAP and MATLAB. Could you please explain briefly how you did it, so that others could benefit?

Miss Hadis Moghadam

Subject: Re: Weap automating with Matlab   
Posted: 7/15/2018 Viewed: 5060 times
Hi, i have this problem too.
I want to link weap with matlab(iwo algorithm). Did you found how can you solve this problem?
Mr. Mido Wakeel

Subject: Re: Weap automating with Matlab   
Posted: 1/18/2020 Viewed: 2499 times
Hi everyone,

Did you found how can you solve this problem?

Dr. Jessica Lovering

Subject: Re: Weap automating with Matlab   
Posted: 3/4/2021 Viewed: 807 times
Hi. I am also very interested in this and am getting the issue of WEAP setting my expression to true or false instead of a string or value.

Has anyone made progress on this?

Topic "Weap automating with Matlab"