Page 1 of 1
Export data to Excel or something similar
Posted: Tue Aug 10, 2010 8:09 am
by Mattes_01
Hello @ all.
Again, I am having a question:
I want to export the data from a simulation to Excel to calculate some optimization with MATLAB.
Unfortunately I cannot find any option to export the data.
The help says there should be an export button (even for PLE) but I cannot find it.
If it is not possible to do that with my version, is there another way (maybe a bit mor complicated one) to do that, because this optimization is important for me.
Thank you!
Posted: Tue Aug 10, 2010 9:47 am
by bob@vensim.com
Use the table tool to display the variables you are interested in the, then click on the export button (or use Edit>Copy/Ctrl+c) then in Excel use Edit>Paste/Ctrl+V. For PLE Plus and higher there is a Model>Export Dataaset command as well.
Posted: Tue Aug 10, 2010 11:01 am
by Mattes_01
Correct!
Thank you, so obviously
And yes, I thouught so, that the export button is only available for the other versions.
Regards from germany
[Edited on 8-10-2010 by Mattes_01]
Posted: Mon Sep 06, 2010 10:48 pm
by khalediwm
I want to export, part of my model result (continuously) to a text/Excel file, in every step of my calculation, so that value can be used by another program. I know how to export data after the simulation, but I need to know how to do the same thing during the simulation period. Can anybody please help me?
Posted: Mon Sep 06, 2010 10:56 pm
by tomfid
I think you'd have to write an external function to write the data to text. Fairly simple, but a lot of overhead to get started.
Tom
Posted: Tue Sep 07, 2010 4:59 am
by khalediwm
Thanks tomfid,
If any body has already done it, then please let me have a chance to look at your external library.
Posted: Tue Sep 07, 2010 7:07 am
by Administrator
Do you have DSS? External functions are only available to DSS.
There is a sample C++ project that comes with Vensim, this is the best place to start.
Posted: Tue Sep 07, 2010 8:32 pm
by khalediwm
Yes, I am using Vensim5.10a DSS. I am having problem in writing anything within the vensim external function. It's not same as writing in C++, as I need to know the correct place to insert that code. If possible, can I please have a *.DLL file which can export data from Vensim to a text or xls file, during the simulation period?
it could be like below:
tt=exportvar (variable1, variable2,.., filename)
so, if I just call the function and mention required variables along with filename, then the model will be creating a file and will pass those values continuously.
Posted: Tue Sep 07, 2010 10:44 pm
by tomfid
It's a little more complicated than that. Take a look at venext.c in your Vensim comp directory.
Your function could be almost as simple as the COSINE function example, if you're only writing one variable to a static output file. You'd still have to add some logic to open & close the file in simulation_setup and simulation_shutdown.
If you need anything more than that, you'd probably want to use MYALLTYPES as a template.
In your model, you'd either have to call the logging function once for each variable exported, or perhaps construct an array of all the values and pass that to your function.
Posted: Sat Sep 11, 2010 1:16 pm
by walin
Originally posted by bob@vensim.com
Use the table tool to display the variables you are interested in the, then click on the export button (or use Edit>Copy/Ctrl+c) then in Excel use Edit>Paste/Ctrl+V. For PLE Plus and higher there is a Model>Export Dataaset command as well.
If I do this, it gives an error when I try to paste in excel. Only the time variable is copied...