matlab2014a中help与参考页翻译 Character Strings

来源:互联网 发布:winpe启动盘制作软件 编辑:程序博客网 时间:2024/05/18 12:31
镇场诗:慈心积善融学习,技术誓为大家学。善心速造多好事,前人栽树后乘凉。我今于此写经验,愿见文者得启发。

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Character Strings  字符串

A character string is a sequence of any number of characters enclosed in single quotes. You can assign a string to a variable.

一个字符串就是用两个单引号围起来的,许多个字符。

myText = 'Hello, world';


If the text includes a single quote, use two single quotes within the definition.

如果你文本中包含了单引号,那么按照规定,你需要两个单引号联合表示。

otherText = 'You''re right'

otherText =

You're right


myText and otherText are arrays, like all MATLAB® variables. Their class or data type is char, which is short for character.

myText 和 otherText都是数组,就像所有MATLAB的变量一样。他们类或者说数据类型是char,短字符.~~~~(>_<)~~~~

whos myText

  Name        Size            Bytes  Class    Attributes


  myText      1x12               24  char        

     

You can concatenate strings with square brackets, just as you concatenate numeric arrays.

你可以用方括号来连接字符串,就想你连接数字类型得到数组一样。

longText = [myText,' - ',otherText]

longText =


Hello, world - You're right


To convert numeric values to strings, use functions, such as num2str or int2str.

为了转换数值型变量到字符串型的,我们可以用函数,例如num2str 或者int2str.


f = 71;

c = (f-32)/1.8;

tempText = ['Temperature is ',num2str(c),'C']

tempText =


Temperature is 21.6667C

好强呀。。。;-)



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


感恩帮助过我的人。博客的精髓在技术部分,更在镇场一诗。
我是一个新手,翻译还有许多不完善的地方,请您看翻译的时候多多思考。
MATLAB是一个优秀的软件,值得学习。如果您有一些不会的知识,咱们可以相互讨论。
如果您认为翻译可以有改进的地方,有错误的地方,请留下评论,我会处理的。
注:如果我的博文无意中侵犯了您的权益,请告知。看到您的告知后,我将及时作出处理。

0 0
原创粉丝点击