Azzera filtri
Azzera filtri

if condition in the case where char is empty

6 visualizzazioni (ultimi 30 giorni)
Hi! I generated an empty char:
name = '';
I should create an if-end of the following type:
if % name is empty
name = 'no name';
How to write in Matlab 'if name is empty'?

Risposta accettata

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

Più risposte (0)


Scopri di più su Loops and Conditional Statements in Help Center e File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by