Home  >  Article  >  What is the matlab output statement?

What is the matlab output statement?

藏色散人
藏色散人Original
2020-11-19 11:50:4352685browse

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)".

What is the matlab output statement?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn