フィルターのクリア

if condition in the case where char is empty

12 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 6 月 25 日
回答済み: Mrinal Anand 2023 年 6 月 25 日
Hi! I generated an empty char:
name = '';
I should create an if-end of the following type:
if % name is empty
name = 'no name';
end
How to write in Matlab 'if name is empty'?

採用された回答

Mrinal Anand
Mrinal Anand 2023 年 6 月 25 日
You can use the isempty() function in Matlab to accomplish your task:
name = ''; % empty char variable
if isempty(name)
name = 'no name';
end
This will get you the desired result.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by