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

 採用された回答

ChristianW
ChristianW 2013 年 3 月 4 日

1 投票

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 件のコメント

Elysi Cochin
Elysi Cochin 2013 年 3 月 4 日
thank u so much....
Abdul Rehman Akbar
Abdul Rehman Akbar 2014 年 4 月 10 日
Thank You very much. I was searching this command. your answer is very useful for me.
Nikolay
Nikolay 2019 年 4 月 24 日
I think it should rather be:
exist('A', 'var')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeVariables についてさらに検索

質問済み:

2013 年 3 月 4 日

コメント済み:

2019 年 4 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by