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.

Scripts + Storing value

+1 vote

Is there a way to store a value in a simulation run that I can then use for the next simulation (both simulation runs via script).

asked Feb 1, 2018 by munadir (48 points)

1 Answer

+2 votes
Best answer


you can place an output port on your top level schematic. When you run plecs('simulate') it returns the values of the signals that are connected to top-level output ports. These values can then be assigned to variables in the next simulation run (using the ModelVars struct in the simulate command).

Kind regards,


answered Feb 1, 2018 by Oliver Schwartz (345 points)
selected Feb 1, 2018 by munadir
Thanks! That was helpful. I hacked up one of the PLECS demo models and am attaching it.