# For Loop for Inputs

**URL:** <https://forum.plexim.com/t/for-loop-for-inputs/1234>\
**Category:** PLECS\
**Tags:** c-script, define\
**Created:** [April 27, 2023, 5:26am UTC](https://forum.plexim.com/t/for-loop-for-inputs/1234 "2023-04-27T05:26:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magdalini](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Magdalini](https://forum.plexim.com/u/Magdalini)\
**Post date:** [April 27, 2023, 5:26am UTC](https://forum.plexim.com/t/for-loop-for-inputs/1234/1 "2023-04-27T05:26:41Z")

</div>

Maybe I didn’t form the question correctly. In the picture attached you can see that C-Script has as Inputs 1\_prev, 2\_prev, …, 6\_prev, which are signals that indicate 6 different states. How can I define these Inputs inside the C-Script block in a way to place these variables-Inputs in a matrix by using a for loop? You can find the pictures attached.

---

<div class="post-metadata">

**Author:** ![Bryan\_Lieblick](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/bryan_lieblick/32/10_2.png) [@Bryan\_Lieblick](https://forum.plexim.com/u/Bryan_Lieblick)\
**Post date:** [April 28, 2023, 11:38am UTC](https://forum.plexim.com/t/for-loop-for-inputs/1234/2 "2023-04-28T11:38:58Z")

</div>

Your question might not be clear still. Could you post some pseudo code of how you expect your matrix to look in the C-Script and what operations you’d like to do with it?

---

<div class="post-metadata">

**Author:** ![Magdalini](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Magdalini](https://forum.plexim.com/u/Magdalini)\
**Post date:** [May 2, 2023, 10:41am UTC](https://forum.plexim.com/t/for-loop-for-inputs/1234/3 "2023-05-02T10:41:16Z")

</div>

In fact, I want to place the Input Signals in a matrix inside the C-Script, but I want to do it by using a for loop. The thing is that now I have only 6 Input Signals (1\_prev, 2\_prev…, 6\_prev), but later on the Input Signals will increase to 50. So it will be easier to use a for loop I think. Thank you again!
