Filter löschen
Filter löschen

how to delete all the elements from the matrix?

14 Ansichten (letzte 30 Tage)
Roma
Roma am 27 Mär. 2014
Beantwortet: Jos (10584) am 27 Mär. 2014
i want to delete all the elements from the matrix, and make the matrix empty.
  1 Kommentar
Walter Roberson
Walter Roberson am 27 Mär. 2014
What data type is the matrix? Should the empty matrix have the same data type?

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Chandrasekhar
Chandrasekhar am 27 Mär. 2014
a = [1 2;3 4]
to make this matrix empty.then
a = [];

RAGHAVENDRA
RAGHAVENDRA am 27 Mär. 2014
Bearbeitet: RAGHAVENDRA am 27 Mär. 2014
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) am 27 Mär. 2014
Several options, depending on the desired result (same class, for instance):
A = []
A(:) = []
A = zeros(0,0,class(A))

Community Treasure Hunt

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

Start Hunting!

Translated by