Hi,
I'm trying to call Vensim from Matlab and have gone quite far with the help of previous forum questions, yet I seem to have bumped into a new issue.
When loading the library in Matlab, I receive the following message:
"Warning: The function 'vensim_get_run_info' was not found in the library"
I have installed the 64-bit version of both Vensim and Matlab. Vensim was installed as an administrator.
Any suggestions?
Matlab and Vensim
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Matlab and Vensim
How do you load the library? Do you pass a header file to Matlab?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Matlab and Vensim
Yes, I used a header file. The code I used was:
if not(libisloaded('VenDLL64'))
hfile = ['C:\Users\Public\Vensim\DLL\vendll.h'];
loadlibrary('VenDLL64',hfile);
end
It finds the library. The output message is:
Warning: The function 'vensim_get_run_info' was not found in the library
> In loadlibrary
In LoadVensimLibrary (line 3)
if not(libisloaded('VenDLL64'))
hfile = ['C:\Users\Public\Vensim\DLL\vendll.h'];
loadlibrary('VenDLL64',hfile);
end
It finds the library. The output message is:
Warning: The function 'vensim_get_run_info' was not found in the library
> In loadlibrary
In LoadVensimLibrary (line 3)
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Matlab and Vensim
ok, if you edit the vendll.h file, comment out line 140 so that it changes from
to
As long as you don't need that function, it should now work.
Code: Select all
CFUNCTION int VEFCC vensim_get_run_info(char *strRunName, int nInfoWanted,char *strReceivingBuffer,int nMaxBufLen) ;
Code: Select all
//CFUNCTION int VEFCC vensim_get_run_info(char *strRunName, int nInfoWanted,char *strReceivingBuffer,int nMaxBufLen) ;
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Matlab and Vensim
Yes, that solves the warning.
What exactly do I lose if I don't have this function?
Further issue:
When running the test code for the rabbit example the output looks strange. Here the beginning:
%rabbit example
str=['SPECIAL>LOADMODEL|RABFOX.vpmx'];
calllib('VenDLL64','vensim_check_status')
calllib('VenDLL64','vensim_command',str)
str=['MENU>RUN|o'];
calllib('VenDLL64','vensim_command',str)
ans =
6
ans =
1
ans =
1
Is this correct?
What exactly do I lose if I don't have this function?
Further issue:
When running the test code for the rabbit example the output looks strange. Here the beginning:
%rabbit example
str=['SPECIAL>LOADMODEL|RABFOX.vpmx'];
calllib('VenDLL64','vensim_check_status')
calllib('VenDLL64','vensim_command',str)
str=['MENU>RUN|o'];
calllib('VenDLL64','vensim_command',str)
ans =
6
ans =
1
ans =
1
Is this correct?
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Matlab and Vensim
It looks correct. See the documentation at
http://www.vensim.com/documentation/26165.htm
and
http://www.vensim.com/documentation/26170.htm
A value of 6 for vensim_check_status indicates "to indicate that Vensim has not freed all of its working memory. Normally a call to vensim_command will correct this."
A value of 1 from the call to vensim_command indicates the command executed correctly.
I'd be interested if you could share your code to load the Vensim DLL into Matlab. Users ask regularly how to do it, but we don't have a copy of Matlab to experiment with.
http://www.vensim.com/documentation/26165.htm
and
http://www.vensim.com/documentation/26170.htm
A value of 6 for vensim_check_status indicates "to indicate that Vensim has not freed all of its working memory. Normally a call to vensim_command will correct this."
A value of 1 from the call to vensim_command indicates the command executed correctly.
I'd be interested if you could share your code to load the Vensim DLL into Matlab. Users ask regularly how to do it, but we don't have a copy of Matlab to experiment with.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Matlab and Vensim
Sure, I can share it! But the forum does not accept .m files attached. Is there another channel to send it?
Still, could you elaborate on what I'm missing by not being able to use the "vensim_get_run_info"?
Still, could you elaborate on what I'm missing by not being able to use the "vensim_get_run_info"?
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: Matlab and Vensim
The vensim_get_run_info function is internal to Vensim, it should not have made it into the vendll.h file.
You can email the Matlab code to vensim@vensim.com, I can then include the important parts with DSS so others can use it.
You can email the Matlab code to vensim@vensim.com, I can then include the important parts with DSS so others can use it.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Matlab and Vensim
Thanks!