0001 function [ravenPath, prevDir] = findRAVENroot()
0002
0003
0004
0005
0006
0007
0008 ST=dbstack('-completenames');
0009 prevDir = pwd();
0010 ravenPath = ST(strcmp({ST.name},'findRAVENroot')).file;
0011 rootFound = 0;
0012 while rootFound == 0
0013 isRoot = isfile(fullfile(ravenPath,'RAVEN2.png'));
0014 if isRoot
0015 rootFound = 1;
0016 else
0017 ravenPathOld = ravenPath;
0018 ravenPath = fileparts(ravenPath);
0019 if strcmp(ravenPathOld,ravenPath)
0020 error('Cannot find the RAVEN root directory. Make sure you have not removed the RAVEN2.png file from your RAVEN installation.')
0021 end
0022 end
0023 end