文档详情

matlab字符串数组元胞数组.ppt

发布:2017-09-08约9.62千字共36页下载文档
文本预览下载声明
第4章字符串数组、元胞数组和结构数组 4.1 字符串数组 4.2 元胞数组(单元数组) 4.3 结构数组(构架数组) 4.1 字符串数组 4.1.1 字符串构造 4.1.2 数字与字符串的相互转换 4.1.3 字符串函数 4.2 单元数组 4.2.1 单元数组的创建 4.2.2 单元数组处理 4.2.3 获得单元数组的内容 4.3 结构数组 4.3.1 创建结构数组 4.3.2 结构处理 4.3.3 获取结构内容 4.3.4 结构函数 要点 字符串数组的创建 字符串转换和操作函数 单元数组的创建和内容获取 结构数组的创建和内容获取 col=circle.color ??? Illegal right hand side in assignment. Too many elements. [c1,c2,c3]=deal(circle.color) c1 = red c2 = green c3 = blue circle = 1x3 struct array with fields: radius center linestyle color filled fieldnames(circle) ans = radius center linestyle color filled isfield(circle,color) ans = 1 isfield(circle,width) ans = 0 class(square) ans = struct isstruct(circle) ans = 1 d=pi; isstruct(d) ans = 0 fnames=fieldnames(circle) fnames = radius center linestyle color circle2=rmfield(circle,fnames{5}) circle2 = 1x3 struct array with fields: radius center linestyle color circle3=rmfield(circle,radius) circle3 = 1x3 struct array with fields: center linestyle color filled * t=How about this character string? t = How about this character string? size(t) ans = 1 32 whos Name Size Bytes Class t 1x32 64 char array Grand total is 34 elements using 80 bytes u=abs(t) u = Columns 1 through 12 72 111 119 32 97 98 111 117 116 32 116 104 Columns 13 through 24 105 115 32 99 104 97 114 97 99 116 101 114 Columns 25 through 32 32 115 116 114 105 110 103 63 char(u) ans = How about this character string? u=t(16:24) u = character u=‘ Hello, ; v=‘ World! ; v=[ Character strings having more than one row must have the same number of column just
显示全部
相似文档