- 27
- 0
- 约3.64千字
- 约 15页
- 2018-04-28 发布于福建
- 举报
MATLAB数据导入与导出
MATLAB的数据导入与导出 MATLAB的数据导入 数据的直接输入 A=[1 2 3 4 5 6]; M文件中生成 利用fopen,fread,和MATLAB输入输出函数。 从ASCII文件中导入 利用load命令 举例 load fname a* % Load variables starting with a load fname -regexp ^b\d{3}$ % Load variables starting with b and % followed by 3 digits load fname -regexp \d % Load variables containing any digits 利用特定文件读取函数 dlmread wk1read textscan textread 创建mex文件读取文件 创建其他程序文件读取 MATLAB的数据导出 diary save –ascii 以特定格式写入文件 利用特定文件写入程序 dlmwrite 作为mat文件输出数据 MATLAB的文件操作 UIGETFILE 对话框打开文件方式. [FILENAME, PATHNAME, FILTERINDEX] = UIGETFILE(FILTERSPEC, TITLE) 显示一个需要用户完成的对话框,返回文件名,文件路径,和是否打开成功,如果打开成功,返回成功标志,否则会出现一错误信息,用户可以打开另一文件,或取消。 [filename, pathname, filterindex] = uigetfile(*.m, Pick an M-file); MATLAB的文件操作 UIPUTFILE 对话框打开文件方式. [FILENAME, PATHNAME, FILTERINDEX] = UIPUTFILE(FILTERSPEC, TITLE) 显示一个需要用户完成的对话框,返回文件名,文件路径,和是否打开成功,如果打开成功,返回成功标志,否则会出现一错误信息,用户可以打开另一文件,或取消。 [filename, pathname] = uiputfile(matlab.mat, Save Workspace as); MATLAB的文件操作 FOPEN 打开文件 FILENAME 可以是一个相对路径,如果文件不在当前目录,系统将会在其他路径进行搜索。 FID = FOPEN(FILENAME,PERMISSION) FID 称为文件标识符,如果错误,返回-1 MATLAB的文件操作 r read w write (create if necessary) a append (create if necessary) r+ read and write (do not create) w+ truncate or create for read and write a+ read and append (create if necessary) W write without automatic flushing A append without automatic flushing MATLAB的文件操作 Two file identifiers are automatically available and need not be opened. They are FID=1 (standard output) and FID=2 (standard error). FID, MESSAGE] = FOPEN(FILENAME,PERMISSION) returns a system dependent error message if the open is not successful. MATLAB的文件操作 FCLOSE Close file. ST = FCLOSE(FID) closes the file with file identifier FID, which is an integer obtained from an earlier FOPEN. FCLOSE returns 0 if successful and -1 if not. ST = FCLOSE(‘a) closes all open files,
您可能关注的文档
- C5.0决策树工具使用UndergraduateDissertation .ppt
- CA8000示波器使用 .ppt
- CAD(计算机辅助设计技术)第4章:二维图形光栅显示 .ppt
- CAD制图基础教程-推荐 .ppt
- CAE现状和未来 .ppt
- candy正午太阳高度应用 .ppt
- CCC认证流程,灯具分类知识及资料准备常识 如有相关需求,请咨询倍通认证咨询QQ420683943 .ppt
- CCTV-4《远方家》贴片广告介绍 .ppt
- CEO管理运营之道经典实用课件之三:象牙塔里CEO .ppt
- CEO须知50个管理理论 .ppt
- 2025年全国演出经纪人员资格认定考试试卷带答案(研优卷).docx
- 2025年全国演出经纪人员资格认定考试试卷完整版.docx
- 2025年全国演出经纪人员资格认定考试试题库及完整答案.docx
- 2025年全国演出经纪人员资格认定考试试卷完美版.docx
- 2025年全国演出经纪人员资格认定考试试卷含答案(实用).docx
- 2025年全国演出经纪人员资格认定考试试卷及答案(各地真题).docx
- 2025年下半年内江市部分事业单位公开考试招聘工作人员(240人)备考题库附答案.docx
- 2025年全国演出经纪人员资格认定考试试卷及答案1套.docx
- 2025年下半年四川成都市郫都区面向社会引进公共类事业单位人员2人备考题库最新.docx
- 2025年下半年内江市部分事业单位公开考试招聘工作人员(240人)备考题库附答案.docx
原创力文档

文档评论(0)