Files
imdd_silas/Functions/helper_functions_community/mat2tikz/test/private/m2troot.m
Silas Labor Zizou 99fe2ca106 Commit Friday evening.
PDFA and EXFO Laser are now part of the family
2024-10-25 20:31:50 +02:00

31 lines
937 B
Matlab

function rootpath = m2troot(varargin)
% M2TROOT produces paths inside the matlab2tikz repository
%
% Usage:
% There are two ways to call this function, the base syntax is:
%
% * rootpath = m2troot()
%
% where |rootpath| points towards the root of the repository.
%
% The other syntax:
%
% * path = m2troot(...)
%
% is equivalent to |fullfile(m2troot, ...)| and as such allows to
% easily produce a path to any file within the repository.
m2t = which('matlab2tikz');
if isempty(m2t)
error('M2TRoot:NotFound', 'Matlab2tikz was not found on the PATH!')
end
[srcpath] = fileparts(m2t); % this should be $(m2troot)/src
[rootpath, srcdir] = fileparts(srcpath); % this should be $(m2troot)
assert(strcmpi(srcdir,'src'));
if nargin >= 1
rootpath = fullfile(rootpath, varargin{:});
end
end