Can I create a matrix with unknown dimension ?
12 次查看(过去 30 天)
显示 更早的评论
Can Matlab allow me to create a matrix that has an unknown dimension ? In case that the amount of data is unknown.
0 个评论
回答(2 个)
Azzi Abdelmalek
2014-11-17
If you want to pre-allocate just set your matrix to
A=zeros(n,m)
nxm is the biggest dimension you are expecting
0 个评论
Adam
2014-11-17
编辑:Adam
2014-11-17
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"
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!