Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

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

+1 vote
1,759 views
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?
asked Mar 13, 2018 by Joelkirkby (13 points)

2 Answers

+1 vote

Hello 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

answered Mar 14, 2018 by chrisbietz (54 points)
0 votes
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
answered Mar 17, 2018 by Kris Eberle (1,575 points)
...