Borrar filtros
Borrar filtros

how to put a list numbers from the user into a matrix in matlab

3 visualizaciones (últimos 30 días)
brett cursey
brett cursey el 16 de Abr. de 2016
Respondida: Image Analyst el 16 de Abr. de 2016
Okay, so I want to ask the user for a list of numbers, is there a way to take that list and turn it into a matrix.

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 16 de Abr. de 2016
s=inputdlg('enter your matrix like this [1 2;4 6]');
out=str2num(s{:})
  2 comentarios
brett cursey
brett cursey el 16 de Abr. de 2016
so if the user enters something like 5 2 8 9 in a GUI text box. And I like to turn that into a matrix in the form of [5;2;8;9]
Azzi Abdelmalek
Azzi Abdelmalek el 16 de Abr. de 2016
a=get(handles.edit1,'string')
b=str2num(a{:})'

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 16 de Abr. de 2016
You can use a uitable. Use GUIDE and place a grid control on it. Then somewhere in your code, stick your data into it like this:
uitable1.data = yourData;
where uitable1 is the "tag" name of your control that you placed on the GUI.

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