Matrix input problem

Hello guys.
I want to get a matrix components in my app. I want it to be a 3*3 matrix and have a + button to increase the size of the matrix each time it is clicked( also want a button to decrease the size of the matrix). I dont know how to design it in an app.
Thanks for your help.
Moosavi

Welcome to the Forum, @s.a.moosavi!

There are probably many different ways to approach this design, depending on a variety of factors. To list just a few:

  1. What kinds of values are in the matrix cells: text, numbers, checkmarks, …
  2. Are any rows or columns special in any way, e.g., row headers? Column headers?
  3. What (if anything) you want your app to do to/with the values, for each user, after the user has entered them.

A matrix usually doesn’t exist in a vacuum. Usually, it’s part of a solution to a larger problem. That context helps clarify any additional requirements you might have. Could you tell us a bit more about it? To help us fit the solution to the problem?

2 Likes

I build an app with a resizable matrix (4x4 to 6x6). See [Link: https://calcudoku.anvil.app/](Link: https://calcudoku.anvil.app/). Is that simular to your needs?

Hello p.colbert,
Thanks for your help. I just want to input a matrix from user and do some calculation on it, values are real numbers, there is nothing special(row or column).

Thanks a lot.

This sounds like the Linear Algebra version of a matrix: all the elements are of the same type, there are no special “header” rows or columns. It’s just a two-dimensional array of numbers.

In Linear Algebra, a matrix does not have to be square. Does yours need to be square?

Anvil’s built-in multi-column components are aimed more at CSVs and database tables, where the set of columns is fixed in advance, and the columns are named. Adding/removing rows is trivial; adding/removing columns is less so.

These components might still be appropriate IF the matrix has to be remembered from one visit to another. Does it have to be remembered?

Either way, you’d probably benefit from a clear separation between the user interface’s data structures, and the ones you use for actually working on the entered data.

Thanks nerd. My app is similar but not completely.
I want that user be able to put real numbers in matrix and then push a button and do some calculation on the matrix.
Again Thanks.