There are two types of matlab output statements, namely: 1. Free format, with syntax such as "disp(23 454-29*4)"; 2. Formatted output, with syntax such as "fprintf('The area is %8.5f\n',area)".
MATLAB input and output statements
1.MATLAB input statement input function is used to receive user input :
a.Input data
>> x=input('please input a number:') please input a number:22 x = 22
b.Input string
>> x=input('please input a string:','s') please input a string:this is a string x = this is a string
2.MATLAB output statements include free format (disp) and formatted output (fprintf)
>> disp(23+454-29*4) 361 >> disp([11 22 33;44 55 66;77 88 99]) 11 22 33 44 55 66 77 88 99 >> disp('this is a string') this is a string >> area=12.56637889; >> fprintf('The area is %8.5f\n',area) The area is 12.56638 >>
The above is the detailed content of What is the matlab output statement?. For more information, please follow other related articles on the PHP Chinese website!