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.

Define a matrix of inputs in C-Script

0 votes
208 views
I am trying to define many inputs (voltages in a multilevel converter) as a matrix and not one by one. Could anyone help me?

Thank you :)
asked Apr 20, 2023 by Magdalini (20 points)

1 Answer

0 votes

See the excerpt from the C-Script help below. 

Say you have a 3x3 matrix. If I'm understanding your question correctly, one could:

  • Set the Number of Inputs field be "9".  There will be one input port to the C-Script block. Access the matrix entries as InputSignal(0, 3*Row + Column)
  • Set the Number of Inputs field be "[3, 3, 3]".  The C-Script will have 3 input ports, each with three elements. Access the matrix entries as InputSignal(Row,Column)

answered Apr 24, 2023 by Bryan Lieblick (1,887 points)
For Loop for Inputs
...