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개)

Chandrasekhar
Chandrasekhar 2014년 3월 27일

0 개 추천

a = [1 2;3 4]
to make this matrix empty.then
a = [];
RAGHAVENDRA
RAGHAVENDRA 2014년 3월 27일
편집: RAGHAVENDRA 2014년 3월 27일

0 개 추천

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일

0 개 추천

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일

답변:

2014년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by