How to get input vector from a user in App Designer?

13 visualizaciones (últimos 30 días)
AbuYusuf
AbuYusuf el 23 de Nov. de 2017
Comentada: Samuel David Solano Celis el 4 de Sept. de 2022
Hi,
I am using App Designer to build a GUI interface for my code. My code requires a numeric input from user to start. I used the Numeric Box available in App Designer but it did not work all types of number. So, I want the App to accept the user input of any type either integer, decimal or vector.
One example, the user can input A = 1 Another example, the user can input A= 0.5 or even a vector, A= 1 2 3 0.5 0.7 ..etc
I hope you can help me on this?
Thanks

Respuesta aceptada

Birdman
Birdman el 23 de Nov. de 2017
To input a vector and decimals, I suggest you to use Numeric Text Field because by the help of conversions, you are able to get input vector. What you write to those fields are obtained as strings by default, so all you need to do is to convert them to double, but input the vectors by writing commas like:
a=app.NumericTextEditField.Value;%your input is a=[1,2,3,4];
aConverted=str2double(strsplit(a,','));
By this conversion, you obtain a numeric vector. Hope this helps and you understand what I mean.
  6 comentarios
Fernando Rodriguez
Fernando Rodriguez el 5 de Abr. de 2021
I appreciate it, thanks for the answer Irma
Samuel David Solano Celis
Samuel David Solano Celis el 4 de Sept. de 2022
thanks, but, how can i use this with negative numbers input?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by