第二章数组与矩阵.pptVIP

  • 3
  • 0
  • 约2.01万字
  • 约 64页
  • 2018-10-18 发布于天津
  • 举报
第二章数组与矩阵.ppt

要删除一个字段,可用rmfield命令,其使用格式如下: ??? new_array=rmfield(array,field) ??? 例如,要删除age字段,可输入如下: ??? student2=rmfield(student,age) ??? student2= ??? ??? l*2 struct array with fields: ??? ??? name ??? ??? scores lsstruct命令可用于测试变量是否为结构数组,如下: ??? s=struct(name, {Tim,Ann },scores,{[l 3 5],[2? 4? 6]}); ??? lsstruct(s) ??? ans = ??? ??? ?? 1 ??? isfield命令则可用于测试某结构数组是否含一特定字段,例如: ??? isfield(s,name) ??? ans= ????? 1 ??? isfield(s,height) ??? ans= ????? 0 ??? 在上例中,因s并不包含“height的字段,故返回数值为0。 Cell Indexing法: ??? A(1,1)={This is the first cell.}; ??? A(1,2)={[5+j*6,4+j*5]}; ??? A(2,1)={[1 2 3; 4 5 6;7 8

文档评论(0)

1亿VIP精品文档

相关文档