当前位置: 首页 > news >正文

网站建设论文百度云盘外贸网站建设方案

网站建设论文百度云盘,外贸网站建设方案,企业信息公开网查询,网站的主机空间是文章目录Part.I 元胞相关Chap.I 创建空 char 型元胞Part.II 矩阵相关Chap.I 矩阵插入元素Part.III 字符串相关Chap.I 获取一个文件夹下所有文件的文件名的部分内容Part.IV 结构体相关Chap.I 读取结构体Chap.II 取结构体中某一字段的所有值本篇博文记录一些笔者使用 Matlab 时根据自己的需求编写的一些小函数。 Part.I 元胞相关 Chap.I 创建空 char 型元胞 matlab可以创建空元胞矩阵cell(a,b);只不过创建好之后里面存储的类型是空double笔者想要创建一个空元胞矩阵且里面存放的数据类型是char所以笔者编写了这样一个函数 % get a null cell which is a*b dims function datakcell(a,b) datacell(a,b); for i1:afor j1:bdata(i,j)cellstr(num2str(data{i,j}));end end endPart.II 矩阵相关 Chap.I 矩阵插入元素 Matlab 在一个行向量/列向量某个位置处插入一个值 % insert num at ind in mat function datainsert(mat,ind,num) nlength(mat); data(ind)num; data(1:ind-1)mat(1:ind-1); data(ind1:n1)mat(ind:n); endPart.III 字符串相关 Chap.I 获取一个文件夹下所有文件的文件名的部分内容 最近搞事情想从一个目录中提取所有文件的文件名中前几个字符并转换为char。原来发现我一直存在一个误区“ 和引起来的东西是相同的”。今天才发现是不同的然后又学到了一写新的东西比如元素取唯一获取目录中所有文件的名字…… % get sitename from a dir function sitegetSite_dir(enudir) dirOutput dir(fullfile(enudir));% 此行下面一行获取目录所有文件名 plyName {dirOutput.name}; % get a cell mat plyName plyName(3:end); % rm . and .. nlength(plyName); sitelist; for i1:nfnameplyName{i};siteliststrcat(sitelist, ,fname(1:4)); end sitelistunique(regexp(strtrim(sitelist), \s, split)); %string2char nsitelength(sitelist); site[]; for i1:nsitetmpchar(sitelist(i));tmplower(tmp);site[site;tmp]; end end注regexp是以空格为分隔符将str变为str array。char是用单引号引起来的字符串string是用双引号引起来的字符串两者之间的转化用它们的名字即可char合并用[]string合并用strcmp。 Part.IV 结构体相关 Chap.I 读取结构体 比如我现在想读取这样一个文件到结构体中。文件内容如下 name sex age hobby aa man 4 8 ab wom 5 9 bb wom 6 10 cc man 7 11实现函数如下 % get struct from clkdif file function sturead_dif(file) fidfopen(file,r); str fgetl(fid); S regexp(str, \s, split); %field nlength(S); j1; while ~feof(fid)str fgetl(fid);strstrtrim(str); %rm the blankSpace on the beg and endif str(1)-continue;endif str(1:3)EOFbreak;endtmp regexp(str, \s, split);for i1:neval([stu(j).,S{i},tmp{i};]);endjj1; end fclose(fid); end调用示例 clc;clear; fileC:\Users\OHanlon\Desktop\a.txt; tic; sturead_dif(file); toc;Chap.II 取结构体中某一字段的所有值 可以和上面的函数配合使用 % get the field value from sta function dataget_fdata(sta,field) data[]; affieldnames(sta); nlength(af); for i1:nif mstrcmp(af{i},field)0break;end end if (mstrcmp(af{i},field)~0)disp(----error----);disp([The filed ,field, is not in sta!]);disp(------end----);return; end mlength(sta); for i1:mdataeval([[data;sta(i).,field,];]); end end
http://www.dnsts.com.cn/news/14470.html

相关文章:

  • 学校网站建设联系电话公司地址查询网站
  • 优跃达官网网站建设项目有自己团队做网站上线多久
  • 您有新信息 建设招标网官方网站17网站一起做网店新塘
  • 智达世通建设集团有限公司网站wordpress主题添加字体设置
  • 织梦网站管理安装免费的手机网站模板
  • 企业免费网站推广公司小程序模板大全
  • 东莞哪家网站建设专业小游戏制作开发
  • 做球迷网站济南网络招聘
  • 亚洲做性视频网站网站策划编辑如何做
  • c语言怎么做网站重庆网站建公司大全
  • 网站移动端指的是什么网站类别标签文本
  • 寮步做网站济南j建设网
  • 广东网站建设哪里有赣州门户网站建设
  • 网站租用泸州网站建设公司
  • 建设网站服务商小白学网站建设与设计书
  • iis网站主目录阿里云网站更换域名
  • 西安关键词网站排名输入关键词就能写文章的软件
  • 网站可以同时做竞价和优化吗注册门户网站
  • 专业制作网站服务wordpress静态页生成
  • 喜欢网站建设学什么专业微信网站改版价格
  • 做网站人wordpress 管理密码
  • 网站开发房源岗位网站定位
  • 北京建网站公司哪家便宜广告免费设计在线生成
  • 网站开发过程分为哪几个阶段lnmp 网站开发总结
  • 佛山网站设计代理商泰国做彩票网站
  • 网站开发客户wordpress常见问题
  • 做汽车商城网站seo自助建站平台
  • 网站运营内容方案wordpress ftp 主机名
  • 东营做网站优化的公司中航建设集团网站
  • 如何更快的学习.net网站开发用凡科做的手机网站版