In Matlab or GNU Octave, this command input("")
allows to break the input process by pressing CTRL+C or CTRL+Z. Is there a way to block this, so that only a valid input is accepted?
Note: Pressing CTRL+Z on an input command even exits the Octave shell in a Linux terminal, so I understand that the control must be established at a different layer.
So you want input
to ignore when Ctrl + C is pushed? I don't think that's possible simply because this could potentially be dangerous. Ignoring listening to Ctrl + C could open the possibility of your code running endlessly and you not being able to break out of the code unless you manually kill MATLAB. I'm not saying that what you desire with input
will be dangerous, but if MATLAB allowed you to ignore this keystroke in any capacity, then you'd have that dangerous situation that I talked about if used improperly.
FWIW, check out this link on MATLAB Central: http://www.mathworks.com/matlabcentral/answers/25213-disabling-ctrl-c-in-a-gui . Here, someone is trying to ignore Ctrl + C so that their GUI doesn't needlessly crash, but MathWorks confirms that it is not possible to do so.