|
Re: How do use arrow keys as inputs in matlab?
I've never coded in Matlab, but if i'm not mistaken (and people that have done a fair share of matlab code will correct me if i'm wrong), this is done with the use of the input function
input(prompt_string, ['s']) where prompt string is the prompt, and 's' is an optional variable signifying to return a string rather then a numeric value
example
Code:
power_state=0;
power = input('Power up? (Y/N) [Y]: ', 's');
power = upper(power);
switch (power)
case 'Y'
power_state=1
case 'N'
power_state=0
otherwise
power_state=1
end
As to using arrow keys, as far as i can see there is no way to read continuous input from the keyboard, as i am not sure that Matlab was meant as that kind of a language. You could probably use Python with Matlab to achieve all that, or maybe call C functions to get your the input, but at the moment i can not find a way to read continuous input, i just dont think it was made to be that kind of a language...
|