I have been working on MATLAB scripts. Basically, I have a lot of functions and data files (collectively known as kernels):
I want to organize it a little bit. The idea is
- to create a subfolder named
functions
and save all functions in it. - Another
kernels
and save all data kernel files in it.
Later by adding these paths at runtime, all the scripts should be able to access these functions and kernels without giving the full path to them, i.e. The script should search it in the subfodlers too.
Applying addpath(genpath(pwd));
worked for functions but it couldn't access kernel files
e.g. What if I want to access file named naif0010.tls
inside subfolder kernels
.
It didn't work. Any suggestions.
Example:
% Add the current script directory and subfolders to search path
addpath(genpath(pwd));
% Load NASA Spice (mice) to the script here
% add MICE reference path to MATLAB
addpath('C:\Program Files\MATLAB\R2012b\extern\mice\src\mice');
addpath('C:\Program Files\MATLAB\R2012b\extern\mice\lib');
% Load leap second kernel
% If the leapsecond kernel is placed in script directory
% This file is present in pwd/kernel/naif0010.tls
cspice_furnsh('naif0010.tls');