필터 지우기
필터 지우기

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 CenterFile Exchange에서 Loops 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