




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1.编制一个脚本,查找给定字符串中指定字符出现的次数和位置;str=hopes,dreams,holdup,holdup;findstr(str,o)%位置ans=1523a=findstr(str,o);n=length(a)%次数n=2编写一个脚本,判断输入字符串中每个单词的首字母是否为大写,若不是则将其修改为大写,其他字母为小写。str=ihaveadreamcometrue;nlength=length(str);fork=1:nlengthif(k=1|isspace(str(k-1)&(str(k)=a)str(k)=char(double(str(k)-32);endenddis
2、p(str);IHaveADreamComeTrue3.创建2x2单元数组,第1、2个元素为字符串,第三个元素为整型变量,第四个元素为双精度(double)类型,并将其用图形表示。A=cell(2,2)A(Ll)=beijing;A(2,1)=BELIING;A(l,2)=uint8(5);A(2,2)=1,2;4,刀cellplot(A)A=A=beijing5BEIJING2x2double4创建一个结构体,用于统计学生的情况,包括学生的姓名、学号、各科成绩等。然后使用该结构体对一个班级的学生成绩进行管理,如计算总分、平均分、排列名次等。student=struct(name,bam,ma
3、rk,jimin,number,1,2,3,scores,75,89,82,93,78,90,85,62,77,subject,english,math,chinese,english,math,chinese,english,math,chinese)student=1x3structarraywithfields:namenumberscoressubjectstudent(1)ans=name:bamnumber:1scores:758982subject:english,math,chinesestudent(2)ans=mean(student(1).scores)mean(stud
4、ent(1).scores)name:marknumber:2scores:937890subject:english,math,chinesestudent(3)ans=name:jiminnumber:3scores:856277subject:english,math,chinesesum(student(1).scores)ans=246sum(student(2).scores)ans=261sum(student(3).scores)ans=224ans=82mean(student(2).scores)ans=87mean(student(3).scores)ans=74.666
5、7new,index=sort(student.scores,descend)new=939089858278777562index=462735918student(1).mean=mean(student(1).scores)student(2).mean=mean(student(2).scores)student(3).mean=mean(student(3).scores)student=1x3structarraywithfields:namenumberscoressubjectmeanstudent=1x3structarraywithfields:namenumberscoressubjectmeanstudent=1x3structarraywithfields:namenumberscoressubjectmeanstudent(1)ans=name:bamnumber:1scores:758982subject:english,math,chinesemean:82student(2)ans=name:marknumber:2scores:937890subject:english,math,chinesemean:87student(3)ans=name:jiminnumber:3scores:856277subject:engli
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 水资源节约的宣传教育计划
- 2025年人造岗石树脂合作协议书
- 2025年冷光源:EL冷光片合作协议书
- 2025年涤纶短纤项目合作计划书
- 2025年铝合金精密模锻件项目合作计划书
- 客户关系层次化维护策略
- 数学王国里的奇妙旅程读后感
- 自动化科技设备公司项目投资合作协议
- Pinoxaden-Standard-生命科学试剂-MCE
- Mucic-acid-Standard-生命科学试剂-MCE
- 加气站安全培训课件
- 2025年中考语文一轮复习:九年级上册知识点梳理
- 中国近代史纲要西安财经大学练习题复习资料
- 中国成人ICU镇痛和镇静治疗指南解读
- 延长保修服务合同
- 2023三年级英语下册 Unit 1 How are you第3课时说课稿 湘少版
- 2020-2024年五年高考历史真题分类汇编(山东)专题15 中国古代史(原卷版)
- (房屋建筑部分)工程建设标准强制性条文版
- 《大学英语四级词汇大全》
- 仓库管理培训课件
- 《处方药和非处方药管理现状、存在的问题及完善对策研究》6900字(论文)
评论
0/150
提交评论