Effacer les filtres
Effacer les filtres

choose which function to run it

6 vues (au cours des 30 derniers jours)
Ahmed Amin
Ahmed Amin le 6 Mai 2021
Commenté : Dharmendar le 18 Oct 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

Réponse acceptée

Chunru
Chunru le 7 Mai 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

Plus de réponses (0)

Catégories

En savoir plus sur Desktop dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by