问题 Is there a command like 'scanf' in GNU Octave to read the user inputs from the keyboard? 回答1: Yes, the function is called input . A simple example: octave-3.2.4:3> x = input("Enter a number: ") Enter a number: 25 x = 25 See the documentation for details, like overriding the default parsing behavior. 回答2: In GNU Octave, How to get user input line, aka open stdin: Make a file called: test.m Put this code in there: line = fgetl(stdin); line Run it like so: octave test.m Enter in some words: 5 66