필터 지우기
필터 지우기

how to write empty variable....

조회 수: 243 (최근 30일)
Elysi Cochin
Elysi Cochin 2013년 3월 4일
댓글: Nikolay 2019년 4월 24일
while doing a calculation if i get a variable named "varName" with empty value i wanted to display a message "Dont not Exist"...... how to write a code for checking whether a variable contains value or it is empty... please do reply...

채택된 답변

ChristianW
ChristianW 2013년 3월 4일
A = [] % A is empty
isempty(A) % Is A empty?
exist(A,'var') % Does A exist as variable?
% empty and not existing isnt the same thing
  댓글 수: 3
Abdul Rehman Akbar
Abdul Rehman Akbar 2014년 4월 10일
Thank You very much. I was searching this command. your answer is very useful for me.
Nikolay
Nikolay 2019년 4월 24일
I think it should rather be:
exist('A', 'var')

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by