How to Input in MATLAB
- 1). Start a new MATLAB project normally. Go to "File" and then click "New."
- 2). Use the 'input' function when having to read data by choosing one of the following two possible headers:
"input (prompt)" which evaluates the expression given as an argument, or "input (prompt, 's')" which keeps the data stored in the memory exactly as given, without performing any calculation. - 3). Use "\\n" while typing if you want to input multiple lines into the same variable.
- 4). Press the "Return" key when you are done typing, so MATLAB can actually transfer the data to the memory. An example code is: "data = input ('Continue? Y/N [N]: ', 's');if isempty(data)data = 'N';." This program asks the user for data, and assigns the default value to the variable read if nothing has been typed from standard input.