필터 지우기
필터 지우기

How to delete an empty matrix ?

조회 수: 2 (최근 30일)
Matlab111
Matlab111 2015년 2월 1일
댓글: Image Analyst 2015년 2월 1일
i want delete an empty matrix in this code, after running this code you will get an empty matrix...
a=[ 30.4596 37.6811 93.0000
154.6678 172.8173 91.0000
44.7308 175.6077 94.0000
90.8282 191.0239 91.0000
149.5394 149.1930 70.0000];
b= [9.0000];
tolerance = 0.00001;
% Subtract third columns
matches = abs(a(:,3) - b) < tolerance
% Extract matching rows.
c = a(matches, :);
now i want to delete this "Empty matrix: 0-by-3", how to delete it.

채택된 답변

per isakson
per isakson 2015년 2월 1일
  댓글 수: 1
Image Analyst
Image Analyst 2015년 2월 1일
I think what was meant was
clear c
or
clear('c');

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 2월 1일
I already showed you how to do it with clear('c') in your duplicate post http://www.mathworks.com/matlabcentral/answers/174121-how-to-compare-different-matrix#comment_263635 - no reason to post the question again. I also said that I don't think it's a good idea because when you later go to check it, it will throw an exception if you had deleted it. If you bail out of the function if it's empty, then that's fine but if you're doing that then there's no reason to delete it at all.
  댓글 수: 1
Matlab111
Matlab111 2015년 2월 1일
편집: Matlab111 2015년 2월 1일
ya sorry for that i won't repeat it again sir.. but thank a lot and you helped me a lot, sir...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by