%**************************************************************************
% CLUSTER project: Find datafiles & plot           Autor: Christian Maszl *
% Unit System = [SI]                  Mail: e0025754@student.tuwien.ac.at *
%**************************************************************************

if (isdir('../outputdata')==1)
else
    disp('Can not find outputdata directory.' )
    disp('Please execute "mainprogram" first.')
    return;
end
% Read all files with the extension *.igmmat
filenam=dir('../outputdata/*.igmmat');
% Display found files
for lauf=1:size(filenam)
    if (rem(lauf,2)==1)
        text=sprintf('%c%u%c %s','[',lauf,']',filenam(lauf,1).name);
        disp(text);
    else
        text=sprintf('    %s',filenam(lauf,1).name);
        disp(text);
    end
end
% Ask for package to display
user = str2num(input('Please select datapackage to display!','s'));
% Load the files
mode='-mat';
filename=['../outputdata/',filenam(user,1).name];
eval('load(filename,mode);');
filename=['../outputdata/',filenam(user+1,1).name];
eval('load(filename,mode);');
clear user i lauf filenam filename mode text;
% Plot Diagram 
B=jav(:,1)./jav(:,1);
plotdiagram(B,B,B,B,jav,divB);