function[ReadViewDefVersion,DefECfgFilePath,DefZeroLineStyle,DefZeroLineColor,DefTriggerLineStyle,DefTriggerLineColor,...
DefCursorLineStyle,DefCursorLineColor,DefTrigPoint, DefCursorPoint,DefViewVal,DefMinAmp,...
DefMaxAmp,DefMinPoint,DefMaxPoint,DefMinBase,DefMaxBase, ...
DefChanFigBGColor,DefFileNoVec,Color,LineStyle,DefCalcBaseStatus,...
DefZeroLineStatus,DefTriggerLineStatus,DefCursorLineStatus,...
emegs3dstatus,CutRealBotVal,MinPoint3d,MaxPoint3d,Dim2d3dViewVal,HeadView,ThetaView,PhiView,DistPoint,SensorNameStatus,SensorCircleStatus,...
SensorAsteriskStatus,FlipColormapStatus,ColorMapVal,MinAmp3d,MaxAmp3d,CenterAmpStatus3d,SpecAmpStatus3d,Print2FileStatus3d,...
NColor,PlotEPosStatus,PlotContourStatus ,PlotLatencyStatus ,GrayFitVal ,UseApp ,SLCLambdaApprox ,MNLambdaApprox ,...
PlusMinusStatusVec ,PlusMinusStatus ,PlusMinusVal ,ActMethod ]= ReadViewDef(FilePath)

%	ReadViewDef.m

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Carina Winter, Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.  

HeadModel = [];
CutRealBotVal=[];
MinPoint3d=[];
MaxPoint3d=[];
Dim2d3dViewVal=[];
HeadView=[];
ThetaView=[];
PhiView=[];
DistPoint=[];
SensorNameStatus=[];
SensorCircleStatus=[];
SensorAsteriskStatus=[];
FlipColormapStatus=[];
ColorMapVal=[];
MinAmp3d=[];
MaxAmp3d=[];
CenterAmpStatus3d=[];
SpecAmpStatus3d=[];
Print2FileStatus3d=[];
NColor=[];
PlotEPosStatus=[];
PlotContourStatus =[];
PlotLatencyStatus =[];
GrayFitVal =[];
UseApp =[];
SLCLambdaApprox =[];
MNLambdaApprox =[];
PlusMinusStatusVec =[];
PlusMinusStatus =[];
PlusMinusVal =[];
ActMethod =[];
global hPlot3dMenuFig hPlot2dMenuFig 

fid=fopen(FilePath,'r','b');

F = fread(fid,7,'char');
if strcmp(setstr(F'),'Version')
    ReadViewDefVersion=fread(fid,1,'int16');
else
    ReadViewDefVersion=0;
    fseek(fid,0,-1);
end
StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefECfgFilePath = setstr(F');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefZeroLineStyle = setstr(F');
DefZeroLineColor = fread(fid,3,'int8');
if ReadViewDefVersion>1
    DefZeroLineStatus = fread(fid,1,'int8');
else
    DefZeroLineStatus=1;
end

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefTriggerLineStyle = setstr(F');
DefTriggerLineColor = fread(fid,3,'int8');
if ReadViewDefVersion>1
    DefTriggerLineStatus = fread(fid,1,'int8');
else
    DefTriggerLineStatus=1;
end

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefCursorLineStyle = setstr(F');
DefCursorLineColor = fread(fid,3,'int8');
if ReadViewDefVersion>1
    DefCursorLineStatus = fread(fid,1,'int8');
else
    DefCursorLineStatus=1;
end

DefTrigPoint = fread(fid,1,'float32');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefCursorPoint = setstr(F');

DefViewVal = fread(fid,1,'int8');

DefMinAmp = fread(fid,1,'float32');
DefMaxAmp = fread(fid,1,'float32');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefMinPoint = setstr(F');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefMaxPoint = setstr(F');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefMinBase = setstr(F');

StringSize = fread(fid,1,'int8');
F = fread(fid,StringSize,'char');
DefMaxBase = setstr(F');
if ReadViewDefVersion>0
    DefCalcBaseStatus=fread(fid,1,'int8');
else
    DefCalcBaseStatus=1;
end
DefChanFigBGColor = fread(fid,3,'float32');	%Geaendert MJ
vec_size = fread(fid,1,'int8');
DefFileNoVec = fread(fid,vec_size,'int8');

for FileNo=1:length(DefFileNoVec)
    Color(FileNo)=fread(fid,1,'int8');
    LineStyle(FileNo) = fread(fid,1,'int8');
end;

emegs3dstatus =  fread(fid,1,'int8');
if emegs3dstatus
    try
        
        HeadModel= fread(fid,1,'int8');
		CutRealBotVal = fread(fid,1,'int8');
		MinPoint3d = fread(fid,1,'int8');
		MaxPoint3d  = fread(fid,1,'int8');
        Dim2d3dViewVal = fread(fid,1,'int8'); 
        HeadView= fread(fid,1,'int8');
        ThetaView = fread(fid,1,'int16');
        PhiView = fread(fid,1,'int16');
        DistPoint = fread(fid,1,'int8');
        SensorNameStatus = fread(fid,1,'int8');
        SensorCircleStatus = fread(fid,1,'int8');
        SensorAsteriskStatus = fread(fid,1,'int8');
        FlipColormapStatus = fread(fid,1,'int8');
        ColorMapVal = fread(fid,1,'int8');
        MinAmp3d = fread(fid,1,'float32');
        MaxAmp3d = fread(fid,1,'float32');
        CenterAmpStatus3d = fread(fid,1,'int8');
        SpecAmpStatus3d = fread(fid,1,'int8');
        Print2FileStatus3d = fread(fid,1,'int8');
        NColor = fread(fid,1,'int8');
        MoviePauseStatus = fread(fid,1,'int8');
        PlotEPosStatus = fread(fid,1,'int8');
        if HeadModel~=1;PlotContourStatus=3;end
        PlotContourStatus = fread(fid,1,'int8');    
        PlotLatencyStatus = fread(fid,1,'int8');
        GrayFitVal = fread(fid,1,'int8');
        ColorAmpTotStatus = fread(fid,1,'int8');
        UseApp = fread(fid,1,'int8');
        SLCLambdaApprox = fread(fid,1,'float32');
        MNLambdaApprox = fread(fid,1,'float32');
        PlusMinusStatus = fread(fid,1,'int8');
        ActMethod = fread(fid,1,'int8'); 
        
	    emegs3dstatus = 1;
    catch
	    emegs3dstatus = 0;
    end
else
   emegs3dstatus = 0;
end

fclose(fid);
