how to delete all the elements from the matrix?

21 次查看(过去 30 天)
i want to delete all the elements from the matrix, and make the matrix empty.

回答(3 个)

Chandrasekhar
Chandrasekhar 2014-3-27
a = [1 2;3 4]
to make this matrix empty.then
a = [];

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=[];

Jos (10584)
Jos (10584) 2014-3-27
Several options, depending on the desired result (same class, for instance):
A = []
A(:) = []
A = zeros(0,0,class(A))

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by