Let us see how to input and output data in MATLAB.
input()
Syntax : input(PROMPT, "s")
Parameters :
- PROMPT : text prompted
- "s" : optional, to input a string
Returns : the data entered
The
input() function is used to input data in MATLAB.
Example :
Output :
Enter an integer : 10
ans = 10
Enter a string : GeeksforGeeks
ans = GeeksforGeeks
display()
Syntax : display(OBJ)
Parameters :
- OBJ : the object to be displayed
Returns : Nothing
The
display() function is used to output data in MATLAB.
Example :
Output :
GeeksforGeeks
var = 10