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