Azzera filtri
Azzera filtri

how to write empty variable....

150 visualizzazioni (ultimi 30 giorni)
Elysi Cochin
Elysi Cochin il 4 Mar 2013
Commentato: Nikolay il 24 Apr 2019
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...

Risposta accettata

ChristianW
ChristianW il 4 Mar 2013
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 Commenti
Abdul Rehman Akbar
Abdul Rehman Akbar il 10 Apr 2014
Thank You very much. I was searching this command. your answer is very useful for me.
Nikolay
Nikolay il 24 Apr 2019
I think it should rather be:
exist('A', 'var')

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Debugging and Analysis in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by