# Making bound variables from loop in Pluto

**URL:** <https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421>\
**Category:** General Usage\
**Tags:** pluto\
**Created:** [March 21, 2023, 9:48pm UTC](https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421 "2023-03-21T21:48:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmj/32/46304_2.png) [@mmj](https://discourse.julialang.org/u/mmj)\
**Post date:** [March 21, 2023, 9:48pm UTC](https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421/1 "2023-03-21T21:48:46Z")

</div>

Hello.  
I am attempting to create a Pluto notebook that performs Gaussian elimination on a matrix. I would like the user to insert whatever matrix he desires. What I have done so far is asking the user what are the dimensions of the matrix, and with such information, I intend to create a number of new bound variables that take the elements of the matrix. I have tried creating a for loop that would create the new variables. However, I am having some trouble making it work.  
I am thankful for all suggestions on how to do this.  
Thank you.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [March 22, 2023, 6:05am UTC](https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421/2 "2023-03-22T06:05:34Z")

</div>

Hey!  
I’m not sure what you mean by “the user inserting a matrix”. Can’t they just put it in a code cell? I feel like a slider for each entry is more complicated than necessary?

---

<div class="post-metadata">

**Author:** ![mmj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmj/32/46304_2.png) [@mmj](https://discourse.julialang.org/u/mmj)\
**Post date:** [March 22, 2023, 5:57pm UTC](https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421/3 "2023-03-22T17:57:26Z")

</div>

Hello!  
I guess that is an option, but I think it would be more elegant to offer something like in this website: [Gauss-Jordan Elimination Calculator](https://matrix.reshish.com/gauss-jordanElimination.php)  
And I wanted to use a text input, not a slider.

---

<div class="post-metadata">

**Author:** ![icweaver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/icweaver/32/45764_2.png) [@icweaver](https://discourse.julialang.org/u/icweaver)\
**Post date:** [March 22, 2023, 9:27pm UTC](https://discourse.julialang.org/t/making-bound-variables-from-loop-in-pluto/96421/4 "2023-03-22T21:27:45Z")

</div>

Maybe `Scrubbable` could be good for this?

```julia
using PlutoUI

A = rand(3, 4)

@bind m Scrubbable(A; format=".3f")

```

![image](https://global.discourse-cdn.com/julialang/original/3X/8/7/87675880a77a0f7668542c4aca66791f8d276097.png)

For more fine control, `PlutoUI.combine` is also great (example modified from the doc example)

```julia
using MarkdownLiteral: @mdx

function wind_speeds(directions)
    PlutoUI.combine() do Child
        @mdx """
        <h6>Wind speeds</h6>
        <ul>
        $([
            @mdx "<li>$(name): $(Child(name, Slider(1:100)))</li>"
            for name in directions
        ])
        </ul>
        """
    end
end

```

![image](https://global.discourse-cdn.com/julialang/original/3X/9/1/916de2ea2b3ff5d95ae8f2009495b6d34da25cad.png)

The inputs can be replaced with `TextField`s, have extra html styling added, etc. I like this notebook as a showcase of what other UI elements can do: [https://featured.plutojl.org/basic/plutoui.jl](https://featured.plutojl.org/basic/plutoui.jl)
