how to delete all the elements from the matrix?

i want to delete all the elements from the matrix, and make the matrix empty.

1 个评论

What data type is the matrix? Should the empty matrix have the same data type?

请先登录,再进行评论。

回答(3 个)

RAGHAVENDRA
RAGHAVENDRA 2014-3-27
编辑:RAGHAVENDRA 2014-3-27
Are you trying to make the matrix as null matrix or want to replace the elements with zeros(erasing the values). In the former case just use A=[];
Several options, depending on the desired result (same class, for instance):
A = []
A(:) = []
A = zeros(0,0,class(A))

类别

帮助中心File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

提问:

2014-3-27

Community Treasure Hunt

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

Start Hunting!

Translated by