MATLAB基本操作(七):有关文件路径的几个函数在编程中的作用
来源:互联网 发布:淘宝手机话费充值 编辑:程序博客网 时间:2024/05/22 06:11
1,genpath: (gen=generate,顾名思义就是一个产生路径的函数,这个路径须存在)
- genpath
- genpath directory
- p = genpath('directory')
>>genpath
其结果为 C:\Program Files\MATLAB\R2009a\toolbox;C:\Program Files\MATLAB\R2009a\toolbox\aero;....
(本人机器上的MATLAB2009a)
>>path=genpath('D:\Code\')% 本人D盘的一个文件夹,如图
结果:显示这个路径下所有的文件夹
- D:\Ccode;
- D:\Ccode\OpenCV_test;
- D:\Ccode\OpenCV_test\Debug;
- D:\Ccode\OpenCV_test\OpenCV_test;
- D:\Ccode\OpenCV_test\OpenCV_test\Debug;
- D:\Ccode\OpenCV_test\images;D:\Ccode\Opencv_Event;
- D:\Ccode\Opencv_Event\Debug;D:\Ccode\Opencv_Event\Opencv_Event;
- D:\Ccode\Opencv_Event\Opencv_Event\Debug;
- D:\Ccode\STL;
- D:\Ccode\STL\Debug;
- D:\Ccode\STL\STL;
- D:\Ccode\STL\STL\Debug;
2,addpath(),添加一条路径,一般会和genpath联合使用
>>addpath(genpath('D:\Code\'))
3,fullfile() 构造一条路径
path=fullfile(dir1,dir2,...,filename);
- f = fullfile('C:', 'Applications', 'matlab', 'myfun.m')
- f =
- C:\Applications\matlab\myfun.m
4,fileparts,将一条路径分成几个部分,如下例子所示
- file = '\home\user4\matlab\classpath.txt';
- [pathstr, name, ext, versn] = fileparts(file)
- pathstr =
- \home\user4\matlab
- name =
- classpath
- ext =
- .txt
- versn =
- ''
0 0
- MATLAB基本操作(七):有关文件路径的几个函数在编程中的作用
- MATLAB基本操作(七):有关文件路径的几个函数在编程中的作用
- 有关文件操作的几个函数
- 有关文件操作的几个函数
- servlet中的几个路径有关的方法
- servlet中的几个路径有关的方法
- servlet中的几个路径有关的方法
- servlet中的几个路径有关的方法
- Matlab的基本文件操作
- 文件路径有关函数
- 文件基本操作(matlab)
- Matlab中的几个函数
- matlab在DSP中的应用(一)---基本函数
- MATLAB基本操作(六):矩阵操作的相关函数
- MATLAB基本操作(六):矩阵操作的相关函数
- 字符串操作函数的几个基本函数
- matlab---文件路径操作
- 文件操作的几个函数
- MATLAB与图像处理(四):将图片序列转化为视频文件,将视频文件转化为图片
- hdfs 简单的api 读写文件
- Servlet的init方法
- SQLServer 2012 使用小错误
- android中的gone、visible、和invisible
- MATLAB基本操作(七):有关文件路径的几个函数在编程中的作用
- mysql基本错误
- nbl2r,htmlspecialchars
- oracle查看允许的最大连接数和当前连接数等信息
- SVM多类分类方法
- 利用JQuery中如何判断元素中是否有文本
- _AFXEXT AFX_EXT_CLASS
- MATLAB基本操作(六):矩阵操作的相关函数
- 羽泉新单曲《一点一滴》首播