Borrar filtros
Borrar filtros

how can i ask the user for 2*2 matrix

1 visualización (últimos 30 días)
mat geek
mat geek el 21 de Abr. de 2019
Comentada: madhan ravi el 21 de Abr. de 2019
I am trying to let the user enter input in matrix form
matr = input ('enter values in matrix form [a,b; c,d]');
but how can I make sure that the user input 2 columns only but whatver rows. I am new to manipulating array and matrix.

Respuestas (1)

madhan ravi
madhan ravi el 21 de Abr. de 2019
Editada: madhan ravi el 21 de Abr. de 2019
if size(matr,2)>2
disp('Has more than 2 Columns beware!')
end
  2 comentarios
mat geek
mat geek el 21 de Abr. de 2019
thank you. Can you explain what are the arguments for the size?
madhan ravi
madhan ravi el 21 de Abr. de 2019
matr represents the input matrix data and 2 represents the number of columns , reading the documentation of size() will clear things for you.
doc size % in command window
help size

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by