Data Extraction from SimBiology Simulations
Ältere Kommentare anzeigen
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 Kommentar
Anh-Dung Le
am 8 Apr. 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?
Akzeptierte Antwort
Weitere Antworten (1)
Sietse Braakman
am 16 Mai 2019
0 Stimmen
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.
12 Kommentare
micronaut
am 20 Mär. 2020
doesn't work on R2018a running on Windows 10. No export to workspace or Excel.
Sietse Braakman
am 20 Mär. 2020
Could you give me more detail on what doesn't work? Is it the writing to excel with xlsread/writetable not working or is the 'Export data' functionality not working in the SimBiology task editor?
Gary Gorman
am 9 Sep. 2022
Hello Sietse. I have Ro22a on MacOS Big Sur 11.6.5.
I cannot find any way to get Simbiology simulation data out of Simbiology and into the Matlab workspace.
1) Simbiology simulation results do NOT automatically appear in the Matlab workspace. Perhaps the Matlab workspace needs to be linked to the Simbiology Model Analyzer by simply opening the Model Builder from the Matlab window?
2) Right click on plot in Simbiology Model analyzer does NOT have an "Export Data" selection. Only "Export Plot" is available. "Export Plot" does indeed export a plot but there is no data with the plot.
Fulden Buyukozturk
am 9 Sep. 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
am 9 Mär. 2023
@Fulden Buyukozturk Thank you. I was looking for an updated answer
Shakir Atoyebi
am 10 Jun. 2024
Hi, I just started using R2023b (I was using R2019a). Thanks for the answers provided above on exporting dat to Excel. Currently, I am able to export results to Excel via "Export Data to MATLAB Workspace". However, all the exported results comes under 1 single sheet "Sheet1" in the exported spreadsheet, even for multiple scan samples. I am hoping there might be a way to export my results into multiple Excel "sheets" like the older version (R2019a).
using R2023b, can simulated data for 50 samples be automatically exported into 50 individual sheets within a single Excel spreadsheet as common for R2019a? Thank you
Fulden Buyukozturk
am 10 Jun. 2024
Hi Shakir,
You can write to different sheets using:
% let's say your exported simdata containing scan results is called results
A = arrayfun(@(x) array2table(x.Data,'VariableNames', x.DataNames),results,UniformOutput=false);
for i=1:length(A)
writetable(A{i}, 'myresults.xlsx', 'Sheet',['Run' num2str(i)])
end
Fulden
Shakir Atoyebi
am 11 Jun. 2024
Bearbeitet: Shakir Atoyebi
am 11 Jun. 2024
Hi Fulden,
Thanks for your kind response. It worked! I was able to use the code you shared to export the results into multiple sheets on Excel.
One more thing, how might I modify the code to get the 'time' values exported alongside the other data within the results? Thank you.
Shakir
Fulden Buyukozturk
am 27 Jun. 2024
Hi Shakir - I missed your follow up question, sorry. To add time data along with state data, you can do:
A = arrayfun(@(x) array2table([x.Time, x.Data],'VariableNames', ['Time'; x.DataNames]),results,UniformOutput=false);
Fulden
Shakir Atoyebi
am 7 Jan. 2025
@Fulden Buyukozturk, Please, is there an update to this code. It is no longer working for me even with R2023b. Thank you.
Jeremy Huard
am 8 Jan. 2025
@Shakir Atoyebi : Can you share the error message you get?
Shakir Atoyebi
am 8 Jan. 2025
@Jeremy Huard, I tried to code again to get the error message. Strangely, it worked now. Thank you.
Communitys
Weitere Antworten in SimBiology Community
Kategorien
Mehr zu Scan Parameter Ranges finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


