Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

how to write empty variable....

Asked by Elysi Cochin on 4 Mar 2013
Latest activity Commented on by Abdul Rehman Akbar on 10 Apr 2014

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...

0 Comments

Elysi Cochin

Products

No products are associated with this question.

1 Answer

Answer by ChristianW on 4 Mar 2013
Accepted 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

2 Comments

Elysi Cochin on 4 Mar 2013

thank u so much....

Abdul Rehman Akbar on 10 Apr 2014

Thank You very much. I was searching this command. your answer is very useful for me.

ChristianW

Contact us