Skip to content

Instantly share code, notes, and snippets.

@jaeandersson
Created June 21, 2016 00:15
Show Gist options
  • Save jaeandersson/cb26ffe71143eb48df819540adbc7207 to your computer and use it in GitHub Desktop.
Save jaeandersson/cb26ffe71143eb48df819540adbc7207 to your computer and use it in GitHub Desktop.
Import package functionality for Octave
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