Azzera filtri
Azzera filtri

choose which function to run it

6 visualizzazioni (ultimi 30 giorni)
Ahmed Amin
Ahmed Amin il 6 Mag 2021
Commentato: Dharmendar il 18 Ott 2023
How can i make user choose which function that will be called
Ex: to run function 1 please enter 1
to run function 2 please enter 2 ..etc

Risposta accettata

Chunru
Chunru il 7 Mag 2021
You can use switch:
f = input('Which function to use? ');
switch f
case 1
func1;
case 2
func2;
otherwise
error('Wrong choice');
end
Of cource, you can also use if..elseif..else..end

Più risposte (0)

Categorie

Scopri di più su Desktop in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by