Borrar filtros
Borrar filtros

Can I create a matrix with unknown dimension ?

3 visualizaciones (últimos 30 días)
piggy_jes
piggy_jes el 17 de Nov. de 2014
Editada: Adam el 17 de Nov. de 2014
Can Matlab allow me to create a matrix that has an unknown dimension ? In case that the amount of data is unknown.

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 17 de Nov. de 2014
If you want to pre-allocate just set your matrix to
A=zeros(n,m)
nxm is the biggest dimension you are expecting

Adam
Adam el 17 de Nov. de 2014
Editada: Adam el 17 de Nov. de 2014
Just working with a matrix in a normal way and using instructions that expand its size (ignoring the warnings you get) is the equivalent of creating a matrix of unknown size, but Azzi's solution above is usually preferable is you can put bounds on your "unexpectations"

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