Chinaunix首页 | 论坛 | 博客
  • 博客访问: 686724
  • 博文数量: 148
  • 博客积分: 4086
  • 博客等级: 上校
  • 技术积分: 1766
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-06 23:27
文章分类

全部博文(148)

文章存档

2013年(19)

2012年(9)

2011年(106)

2009年(14)

分类: WINDOWS

2012-09-05 16:31:50

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 '\' 
阅读(12199) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~