array1 = [1 4 7 3 5 8 9; 12 13 11 10 14 19 17; 22 29 21 24 27 28 20; 33 31 39 30 38 34 35; 41 42 45 49 48 47 46];
The question is
How can you obtain the number of rows and the number of columns of a matrix by applying the length function?
I think the length function shows only the longest length of matrix, so I do not know how to make commands.

 Respuesta aceptada

madhan ravi
madhan ravi el 14 de Jun. de 2020
[rows,columns] = size(array)

5 comentarios

SeungHyun Cha
SeungHyun Cha el 14 de Jun. de 2020
Maybe I did not understand the question, but shouldn't I use only length function to show ros and columns?
madhan ravi
madhan ravi el 14 de Jun. de 2020
Hint: Use indexing for row and column separately.
length(array1(:,1))
ans =
5
length(array1(1,:))
ans =
7
SeungHyun Cha
SeungHyun Cha el 14 de Jun. de 2020
Thanks...!
madhan ravi
madhan ravi el 14 de Jun. de 2020
Exactly! Now make it as a function that returns two outputs.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 14 de Jun. de 2020

Comentada:

el 14 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by