Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6074994
  • 博文数量: 2759
  • 博客积分: 1021
  • 博客等级: 中士
  • 技术积分: 4091
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-11 14:14
文章分类

全部博文(2759)

文章存档

2019年(1)

2017年(84)

2016年(196)

2015年(204)

2014年(636)

2013年(1176)

2012年(463)

分类: WINDOWS

2013-04-15 01:54:13

used functions:

mfilename(): name of the current m-file
fileparts(): get the path string part
filesep: '/' or '\'
strfind(): find a substring from an objective string

code:

currentDepth = 1; % get the supper path of the current path
currPath = fileparts(mfilename('fullpath'));% get current path
fsep = filesep;
pos_v = strfind(currPath,fsep);
p = currPath(1:pos_v(length(pos_v)-currentDepth+1)-1); % -1: delete the last character '/' or '\' 
阅读(1781) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~