From b26456464b01e3f0fcf43d8679f1f54b43e3e81c Mon Sep 17 00:00:00 2001 From: eljais Date: Thu, 17 Nov 2016 15:49:52 +0100 Subject: [PATCH] Nyt MainScript af 15:50 Jaah! --- MainScript.m | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/MainScript.m b/MainScript.m index 4bdee22..f1dd5c4 100644 --- a/MainScript.m +++ b/MainScript.m @@ -26,25 +26,37 @@ %Sub system menu if sId == 1 - System = 'koch' + System = 'koch'; disp('You have chosen the Koch curve!') - N = input('Please enter amount of iterations: ') - LindenMayerString=LindIter(System,N) + N = input('Please enter amount of iterations: ','s'); + N = str2double(N); + N = round(N); + while N < 0 || N >= 15 || isnan(N) + disp('Please choose an integer between 0 and 15!'); + N = input('Please enter amount of iterations: ','s'); + end + LindenmayerString=LindIter(System,N); elseif sId == 2 System = 'sierpinski' - disp('You have chosen the Sierpinski triangle!') - N = input('Please enter amount of iterations: ') - LindenMayerString=LindIter(System,N) + disp('You have chosen the Sierpinski triangle!'); + N = input('Please enter amount of iterations: '); + while N < 0 || N >= 15 + disp('Please choose an integer between 0 and 15!'); + N = input('Please enter amount of iterations: '); + end + LindenmayerString=LindIter(System,N); + end if sId == -1 disp('404 file not found'); end + turtleCommands = turtleGraph(LindenmayerString, System ,N); case 2 %% Generate plots - turtlePlot(turtleCommannds); + turtlePlot(turtleCommands); case 3 @@ -55,4 +67,5 @@ end end -disp('Success!') \ No newline at end of file +disp('Success!') +clear \ No newline at end of file