# Exporting vectors/matrixes in simulation script to a .csv or excel file?

**URL:** https://forum.plexim.com/t/exporting-vectors-matrixes-in-simulation-script-to-a-csv-or-excel-file/300
**Category:** PLECS
**Tags:** simulation-script, data-export
**Created:** [March 13, 2018, 3:52pm UTC](https://forum.plexim.com/t/exporting-vectors-matrixes-in-simulation-script-to-a-csv-or-excel-file/300 "2018-03-13T15:52:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Joelkirkby](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@Joelkirkby](https://forum.plexim.com/u/Joelkirkby)
#### Post date: [March 13, 2018, 3:52pm UTC](https://forum.plexim.com/t/exporting-vectors-matrixes-in-simulation-script-to-a-csv-or-excel-file/300/1 "2018-03-13T15:52:13Z")

</div>

I have been trying to run simulation scripts and output desired values in a matrix, with a column for time and other parameters, rms values etc.

Is there anyway I can export these data tables to an excel file, so that I may do statistical analysis of these collected data points?

---

<div class="post-metadata">

### Author: ![chrisbietz](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/chrisbietz/32/8_2.png) [@chrisbietz](https://forum.plexim.com/u/chrisbietz)
#### Post date: [March 14, 2018, 9:19am UTC](https://forum.plexim.com/t/exporting-vectors-matrixes-in-simulation-script-to-a-csv-or-excel-file/300/2 "2018-03-14T09:19:20Z")

</div>

Hello [Joelkirkby](http://forum.plexim.com/user/Joelkirkby),

As far as I can tell Plecs does not seem to support “csvwrite”, “dlmwrite” or “xlswrite” at this time, “save” however does work. A command as below will save your data without headers in text format to a file. If you open the generated file in a text editor and find/replace all space (" “) characters with commas (”,") excel will correctly load the file as csv.

Example:data = [1:3; 4:6; 7:9];save(“-ascii”, “data.csv”, “data”);

There may be a better way but this seems somewhat workable.

Best regards,

Chris

---

<div class="post-metadata">

### Author: ![Kris\_Eberle](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/kris_eberle/32/6_2.png) [@Kris\_Eberle](https://forum.plexim.com/u/Kris_Eberle)
#### Post date: [March 16, 2018, 6:57pm UTC](https://forum.plexim.com/t/exporting-vectors-matrixes-in-simulation-script-to-a-csv-or-excel-file/300/3 "2018-03-16T18:57:20Z")

</div>

Hello,

Are you generating the data from within the simulation script or using signal condition blocks in your model? In the case of the latter, have you tried using the To File block in PLECS’ System component library? It can automatically generate a .CSV file for you.

Best,

Kris
