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

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

0 votes
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 5 days ago by Joelkirkby (12 points)

2 Answers

0 votes

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.

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,


answered 4 days ago by chrisbietz (36 points)
0 votes

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.


answered 2 days ago by Kris Eberle (125 points)