首页 > 编程知识 正文

matlab输入时怎么换行,matlab里fprintf怎么输出换行

时间:2023-05-06 05:49:32 阅读:270302 作者:4803

目的:在打印字符串后自动换行

ex1:

b ='what is value?n';
a = input(b);
y = a*10;

命令行显示结果

what is value
10

a =

    10


y =

   100

>> 这里的换行符是n,不是/n.

ex2:

b ='what is valuen';
a = input(b);
y = a*10;
disp(y);

命令行显示结果

what is value
20
   200

eg3:

x = input('input x plasen');
y = input('input y plasen');
z = x;
x = y ;
y = z ;
disp('x is');
disp(x);
disp('y is'); z = x;
x = y ;
y = z ;
disp('x is');
disp(x);
disp('y is');
disp(y);

命令行显示结果

input x plase
60
input y plase
50
x is
    50

y is
    60

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。