Home > vbmeg > functions > common > utility > vb_realpath.m

vb_realpath

PURPOSE ^

vb_realpath returns absolute path.

SYNOPSIS ^

function [abs_path] = vb_realpath(input_path)

DESCRIPTION ^

 vb_realpath returns absolute path.
 [USAGE]
    [abs_path, err] = vb_realpath(input_path);
 [IN]
    input_path : relative path or absolute path or 
                 relative file name or absolute file name
 [OUT]
    abs_path : absolute path

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [abs_path] = vb_realpath(input_path)
0002 % vb_realpath returns absolute path.
0003 % [USAGE]
0004 %    [abs_path, err] = vb_realpath(input_path);
0005 % [IN]
0006 %    input_path : relative path or absolute path or
0007 %                 relative file name or absolute file name
0008 % [OUT]
0009 %    abs_path : absolute path
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 %
0015 % --- Previous check
0016 %
0017 if ~exist('input_path', 'var'), input_path = ''; end
0018 
0019 %
0020 % --- Main Procedure
0021 %
0022 javaFileObj = java.io.File(input_path);
0023 
0024 if (javaFileObj.isAbsolute() == false)
0025     abs_path = fullfile(pwd, input_path);
0026 else
0027     abs_path = input_path;
0028 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005