Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab path issues
Date: Fri, 17 Apr 2009 18:54:01 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 16
Message-ID: <gsaj89$n2o$1@fred.mathworks.com>
References: <g8h5eh$ql0$1@fred.mathworks.com> <10659078.1219310055957.JavaMail.jakarta@nitrogen.mathforum.org> <gsaift$2dk$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1239994441 23640 172.30.248.35 (17 Apr 2009 18:54:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Apr 2009 18:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:533603


For sometime I use a function similar to this to return the path of my application:

function pname=APP_path(varargin)

thisfile=mfilename('fullpath');
[pname] = fileparts(thisfile);
if isdeployed
    for upstep=1:2
        pos=find(pname==filesep, 1, 'last');
        pname=pname(1:pos-1);
    end
end

[pname] = strcat([pname filesep],varargin{:});

% Bruno