Matrix Input

I need to get a Matrix from input with known size. for example a 3*3 or 2*2 matrix. i could not do it with 'input'.
thank you.

 Respuesta aceptada

Honglei Chen
Honglei Chen el 6 de Mzo. de 2012

0 votos

You can either save the matrix into a variable and then pass that variable to input, or write matrix at the prompt using delimiter ; instead of enter.
For example
>> b = eye(3);
>> input('get matrix: ')
>> % input b at the prompt
or
>> input('get matrix: ')
>> % input [1 0;0 1] at the prompt

1 comentario

Babak
Babak el 6 de Mzo. de 2012
it is not what i wanted.
i want to get an input matrix from user.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 6 de Mzo. de 2012

0 votos

There is no MATLAB command for getting a matrix of a known size. You can program it through repeated calls to input()

3 comentarios

Babak
Babak el 6 de Mzo. de 2012
you mean that the only way of getting a matrix from user is to use 'input' ?
Jan
Jan el 6 de Mzo. de 2012
A uitable would be fine also.
Babak
Babak el 6 de Mzo. de 2012
can you explain more?

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 6 de Mzo. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by