필터 지우기
필터 지우기

A code to draw other codes together

조회 수: 1 (최근 30일)
Brooke
Brooke 2011년 12월 26일
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!

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by