Matlab中的input命令

Matlab输入help input

input  Prompt for user input. 
    NUM = input(PROMPT) displays the PROMPT string on the screen, waits for
    input from the keyboard, evaluates any expressions in the input, and
    returns the value in NUM. To evaluate expressions, input accesses
    variables in the current workspace. If you press the return key without
    entering anything, input returns an empty matrix.
 
    STR = input(PROMPT,'s') returns the entered text as a MATLAB string,
    without evaluating expressions.
 
    To create a prompt that spans several lines, use '\n' to indicate each
    new line. To include a backslash ('\') in the prompt, use '\\'.
 
    Example:
 
       reply = input('Do you want more? Y/N [Y]:','s');
       if isempty(reply)
          reply = 'Y';
       end

注释:input是Matlab中的输入命令,如果reply=input('Do you want more? Y/N [Y]:');则将输入值赋给reply,reply为double类型,reply = input('Do you want more? Y/N [Y]:','s');   's'的意思是将输入值看作字符串赋给reply,reply为char类型,可用class(reply)查看reply的类型,例子中isempty(reply)是判断reply是否为空,为空返回真,值为1,不为空返回假,值为0

  • 4
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值