Created
March 2, 2018 08:36
-
-
Save robertoostenveld/dca2e176daebf5bda02bba14b01ffe78 to your computer and use it in GitHub Desktop.
logical flow in ft_read_xxx to support the plugin of new file formats
This file contains hidden or 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
hdr = ft_read_header(filename, varargin) | |
filetype = ft_getopt(varargin, 'filetype'); | |
if isempty(filetype) | |
filetype = ft_filetype(filename); | |
end | |
switch filetype | |
case 'aaa': | |
% do whatever it used to be doing | |
case 'bbb': | |
% do whatever it used to be doing | |
otherwise: | |
% try adding fieldtrip/external/"filetype" to the path | |
% it should contain the function read_header_"filetype" and that function should have the same API as ft_read_header | |
if ft_hastoolbox(filetype, 3) | |
funname = sprintf("read_header_%s", filetype); | |
hdr = feval(funname, filename, varargin) | |
end | |
end % switch | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment