Created
June 21, 2016 00:15
-
-
Save jaeandersson/cb26ffe71143eb48df819540adbc7207 to your computer and use it in GitHub Desktop.
Import package functionality for Octave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function varargout = import(varargin) | |
% Import elements from a package | |
% | |
% Cache of aliase | |
persistent imported; | |
% Make sure cell array | |
if ~iscell(imported) | |
imported = cell(0, 1); | |
end | |
if nargin==0 | |
% Return cache | |
varargout{1} = imported; | |
else | |
% Add aliases to cache | |
for i=1:nargin | |
imported{end+1} = varargin{i}; | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment