If the end file location is not in the current working directory of MATLAB, ReadYamlRaw() and WriteYaml() may not properly import snakeyaml because the javapath was not added correctly.
This is due to these lines:
[pth,~,~] = fileparts(filename);
...
...
if not(ismember(dp, javaclasspath ('-dynamic')))
javaaddpath(dp); % javaaddpath clears global variables...!?
end
Notice how the script is looking at the current directory of the file rather than the current working directory.