Azzera filtri
Azzera filtri

A code to draw other codes together

1 visualizzazione (ultimi 30 giorni)
Brooke
Brooke il 26 Dic 2011
Suppose I have 3 m-codes:
code1.m code2.m code3.m
and I want a program to "draw them together" in the sense that when we run the program, we are prompted with, say, "enter code:", then the user types in say "code3" and then code3.m is run.
I am pretty sure there is a simple code to do that, though I can't remember it.
Thank you in advance!

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 26 Dic 2011
whilte true
Code=input('enter code: ','s');
if strcmpi(Code,'quit')
break;
else
try
run(Code);
catch
error('unrecognized code name');
end
end
end

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by