I have a function that I would like to take input for but only when the user wants to. For example if i have this code:
figure
amplitude = 10;
tic
i = 1;
while(1)
time = toc;
values(i) = amplitude*sin(time);
times(i) = time;
plot(times, values)
drawnow
i = i+1;
end
You will get a continually plotting sine wave (like a lame movie). What I want to do is allow the user to change the amplitude of the wave at any time. That is the program will continue to run but if the user types in 20 and Enter then the amplitude variable can be changed and the sine wave will change amplitude in the movie. Any pointers on how to achieve this?