找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 查看内容

matlab输出语句是什么

作者:模板之家 2020-11-19 13:33 71人关注

matlab输出语句有两种,分别是:1、自由格式,语法如“disp(23+454-29*4)”;2、格式化输出,语法如“fprintf('The area is %8.5f\n',area)”。

matlab输出语句有两种,分别是:1、自由格式,语法如“disp(23+454-29*4)”;2、格式化输出,语法如“fprintf('The area is %8.5f\n',area)”。

MATLAB的输入与输出语句

1.MATLAB的输入语句input函数用于接收用户的输入:

a.输入数据

>> x=input('please input a number:')
please input a number:22
x =
   22

b.输入字符串

>> x=input('please input a string:','s')
please input a string:this is a string
x =
this is a string

2.MATLAB输出语句包括自由格式(disp)和格式化输出(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
>>

以上就是matlab输出语句是什么的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: 网络收集

全部回复(0)