octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Package for level-set method?


From: Richard Crozier
Subject: Re: Package for level-set method?
Date: Fri, 09 May 2014 11:28:38 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 09/05/2014 11:18, Daniel Kraft wrote:
Hi!

On 2014-05-09 11:44, Juan Pablo Carbajal wrote:
On Fri, May 9, 2014 at 8:25 AM, Daniel Kraft <address@hidden> wrote:


The "best" way to do that I found so far is to use mfilename() from a
function in the package directory (where also maze.png is installed).
This function is __levelset_getdir.

But if you know a better way to locate and read maze.png from within the
demo, please let me know.  I could of course ask the user to enter the
path to one of their own image files, but I think this makes the demo
too tedious as an example.

Yours,
Daniel


how about

fullfile(fileparts (which('an_m_file_in_the_dir.m'), 'maze.png'))

or something like this

I often put a function in directories of interest like below for similar reasons:

function path = linearmachinerootdir()

    path = getmfilepath(mfilename);

end



where getmfilepath. is just



function filepath = getmfilepath(mfile)
% getmfilepath: gets the directory containing an mfile
%
% Syntax
%
% filepath = getmfilepath(mfile)
%
% Input
%
% mfile is a string containing the name of the mfile for which the
% location is to be found, the .m extension is optional
%
% Output
%
% filepath is the directory path containing the specified mfile
%

    if exist(mfile, 'file') == 2

       filepath = fileparts(which(mfile));

    else
        error('UTILS:nofile', 'm-file does not appear to exist')
    end

end


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]