MATLAB: How to write empty variable….

empty variable

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…

Best Answer

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