Data Extraction from SimBiology Simulations

23 visualizaciones (últimos 30 días)
Andrew Heitman
Andrew Heitman el 16 de Mayo de 2019
Comentada: Milagros Riquelme el 9 de Mzo. de 2023
What is the BEST way to get the simulation data out of simbiology and into excel or some other program?
I have found a brief explanation on how to export to Matlab area and then convert to XLS but its not working terrible well
  1 comentario
Anh-Dung Le
Anh-Dung Le el 8 de Abr. de 2020
I have matlab 2020a now and the simbiology that comes with it is slightly different 2018. However, you can export it to Matlab file and then view the data from there. My problem is the data size isn't large enough and I don't know to increase it. It gives me 70x1 (ie. 70 time units) and the simulations should give alot more if I'm going to export it into excel and use it another graphing platform. Does anyone know how to increase the data size for the simulation?

Iniciar sesión para comentar.

Respuesta aceptada

Sietse Braakman
Sietse Braakman el 16 de Mayo de 2019
Hi Andrew,
Assuming you are using the SimBiology app, you can do this by right-clicking on the simulation plot and selecting 'Export Data':
screenshot1.png
Then you can select to export directly to .xls:
screenshot2.png
If you want to export the data from a SimData object in the MATLAB workspace, you could use code along the lines of:
% make datanames suitable for use as variable names (replace all spaces by underscores)
datanames = tobj.DataNames;
datanames = replace(datanames,' ','_');
%create table from data array
dataTable = array2table(tobj.Data,'VariableNames',datanames);
% create table from time array
timeTable = array2table(tobj.Time,'VariableNames',{'Time'});
% concatenate time and data tables
exportTable = [timeTable dataTable];
% export to .xls file
writetable(exportTable,'exportData.xls')
Let me know how you get on.
  3 comentarios
Sietse Braakman
Sietse Braakman el 16 de Mayo de 2019
Thanks for letting me know. Do you mean the third option in the right-click drop down ("Export Data...") or the third option to export to Excel in the dialog box ("Save data to Excel file:")?
Andrew Heitman
Andrew Heitman el 16 de Mayo de 2019
I updated with a screenshot - I mean the the third option in the dialog box

Iniciar sesión para comentar.

Más respuestas (1)

Sietse Braakman
Sietse Braakman el 16 de Mayo de 2019
It looks like you are on Mac OS - the export to Excel uses the function xlswrite, which unfortunately only works on Windows.
So alas, you'll have to use some code to achieve this. You can use/adopt the code I wrote above. Whenever you simulate a model in your SimBiology task editor, the simulation data will be present in the MATLAB workspace and will be called 'tobj'. You should be able to use that code to write the tobj to an excel. Note that this code uses the writetable function, rather than xlswrite.
  5 comentarios
Fulden Buyukozturk
Fulden Buyukozturk el 9 de Sept. de 2022
The interface in 22a is different than described above.
  • To export results to MATLAB workspace, right-click on LastRun under the program of interest in Model Analyzer and choose "Export Data to MATLAB Workspace"
  • To export results to Excel, add a new Datasheet in Model Analyzer and drag results of the LastRun to the empty datasheet you just created. Right-click anywhere on the Datasheet and choose "Export Datasheet"
To automatically have the results in Workspace after a run in SimBiology, go to Model Analyzer>SimBiology Preferences>Programs, check the box "Export data when program completes executing".
Hope this helps.
Fulden
Milagros Riquelme
Milagros Riquelme el 9 de Mzo. de 2023
@Fulden Buyukozturk Thank you. I was looking for an updated answer

Iniciar sesión para comentar.

Comunidades de usuarios

Más respuestas en  SimBiology Community

Categorías

Más información sobre Scan Parameter Ranges en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by