how to write empty variable....

219 visualizaciones (últimos 30 días)
Elysi Cochin
Elysi Cochin el 4 de Mzo. de 2013
Comentada: Nikolay el 24 de Abr. de 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...

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Variables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by