Filter löschen
Filter löschen

how to write empty variable....

243 Ansichten (letzte 30 Tage)
Elysi Cochin
Elysi Cochin am 4 Mär. 2013
Kommentiert: Nikolay am 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...

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Variables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by