Borrar filtros
Borrar filtros

Which function can be used?

1 visualización (últimos 30 días)
Priya
Priya el 23 de En. de 2014
Respondida: Amit el 23 de En. de 2014
What function is used to define the input matrix B which is of size 14x2? The size of matrix A is 14x14. If I give it as B=zeros(size(A,1),2), I get a blank line at zero. Why is this so?
The result of B shows two columns of zeros using the above function. But I need some value for the B matrix. I'm bit confused about this.
Please do help me.

Respuestas (1)

Amit
Amit el 23 de En. de 2014
zeros(m,n) creates a zero value matrix. That is why you are getting all zero matrixes.
If you want values in B matrix, you can use
  • ones : which puts 1 in all the element
  • (or) rand : which fill your matrix with random number valued between 0 and 1

Categorías

Más información sobre Matrices and Arrays 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