GPS RAW DATA .dat数据读取函数

function varargout = SignalProcessor(varargin)
% SIGNALPROCESSOR M-file for SignalProcessor.fig
%      SIGNALPROCESSOR, by itself, creates a new SIGNALPROCESSOR or raises the existing
%      singleton*.
%
%      H = SIGNALPROCESSOR returns the handle to a new SIGNALPROCESSOR or the handle to
%      the existing singleton*.
%
%      SIGNALPROCESSOR('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SIGNALPROCESSOR.M with the given input arguments.
%
%      SIGNALPROCESSOR('Property','Value',...) creates a new SIGNALPROCESSOR or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before SignalProcessor_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to SignalProcessor_OpeningFcn via varargin.
% 
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help SignalProcessor

% Last Modified by GUIDE v2.5 18-Jul-2008 09:45:21

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @SignalProcessor_OpeningFcn, ...
                   'gui_OutputFcn',  @SignalProcessor_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before SignalProcessor is made visible.
function SignalProcessor_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to SignalProcessor (see VARARGIN)

% Choose default command line output for SignalProcessor
handles.output = hObject;

%initional information
handles.infor.filename    ='0';
handles.infor.readtime    =1;
handles.infor.readpoint   =1;
handles.infor.searchbin   =1;
handles.infor.endpoint    =0;

handles=getfile(hObject, eventdata, handles);
set(handles.fileofcurrentdirectory,'Value',1);% 缺省选第一个文件
%状态条的显示
val = get(handles.fileofcurrentdirectory,'Value');
file=handles.Gpsdatafile(val);
handles.infor.filename=strcat(pwd,'\',file.name);
directory=handles.infor.filename;
filetype = directory(end-4);
switch filetype
    case '1'
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1');
        filesize=strcat(num2str(round(handles.Gpsdatafile(val).bytes*4/16367667*1000)),' ms');
        set(handles.statesbar2,'String',filesize);
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;  
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*4/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);  
        end
    case '2'
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2');
        filesize=strcat(num2str(round(handles.Gpsdatafile(val).bytes*2/16367667*1000)),' ms');
        set(handles.statesbar2,'String',filesize);
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;  
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*2/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);  
        end
    case '3'
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2|channel 3');
        filesize=strcat(num2str(round(handles.Gpsdatafile(val).bytes/16367667*1000)),' ms');
        set(handles.statesbar2,'String',filesize);
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;  
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);  
        end
    case '4'
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2|channel 3|channel 4');
        filesize=strcat(num2str(round(handles.Gpsdatafile(val).bytes/16367667*1000)),' ms');
        set(handles.statesbar2,'String',filesize);
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;  
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);  
        end
    otherwise
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1');
        filesize=strcat(num2str(round(handles.Gpsdatafile(val).bytes*4/16367667*1000)),' ms');
        set(handles.statesbar2,'String',filesize);
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;  
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*4/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);  
        end
end


%*****************************************show in the data process panel
set(handles.readpoints,'Max',handles.infor.endpoint);
set(handles.readpoints,'Value',handles.infor.readpoint);
set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1*4/handles.infor.endpoint]);
set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );

set(handles.readtime1msr,'Value',1);
set(handles.readtimeshow,'String',strcat( num2str(handles.infor.readtime) , ' ms' ) );

set(handles.showpsdb,'Enable','off');
drawnow;
%******************************************show in the correlation panel
for counter=1:1:32,
    str=['set(handles.prn',num2str(counter),'cb,''Value'',0,''Enable'',''off'');'];
    eval(str);
    drawnow;
end

set(handles.selectallb,'Enable','off');
set(handles.confirmb,'Enable','off');
set(handles.startb,'Enable','off');
drawnow;
%******************************************show in the results Panel
for counter=1:1:12,
    str=['set(handles.ch',num2str(counter),'r,''Enable'',''off'');'];
    eval(str);
    drawnow;
end
set(handles.showphaseb,'Enable','off');
set(handles.showcorrb,'Enable','off');
drawnow; 
%**************************************************************************
guidata(hObject, handles);

% UIWAIT makes SignalProcessor wait for user response (see UIRESUME)
% uiwait(handles.NS210);


% --- Outputs from this function are returned to the command line.
function varargout = SignalProcessor_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on selection change in fileofcurrentdirectory.
function fileofcurrentdirectory_Callback(hObject, eventdata, handles)
% hObject    handle to fileofcurrentdirectory (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns fileofcurrentdirectory contents as cell array
%        contents{get(hObject,'Value')} returns selected item from fileofcurrentdirectory

%get the file which has been chose and store the directory to the handles
%struct

handles=getfile(hObject, eventdata, handles);
drawnow;
val = get(handles.fileofcurrentdirectory,'Value');
file=handles.Gpsdatafile(val);
handles.infor.filename=strcat(pwd,'\',file.name);

%*****************************************show in the data process panel
directory=handles.infor.filename;
filetype = directory(end-4);
switch filetype
    case '1'
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*4/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);
        end
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1');
        set(handles.readpoints,'Max',handles.infor.endpoint);
        set(handles.readpoints,'Value',  handles.infor.readpoint);
        set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1*4/handles.infor.endpoint]);
        set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );
        fileinformation=strcat(num2str(round( handles.Gpsdatafile(val).bytes*4/16367667*1000 )),' ms');
        set(handles.statesbar2,'String',fileinformation);
    case '2'
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*2/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);
        end
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2');
        set(handles.readpoints,'Max',handles.infor.endpoint);
        set(handles.readpoints,'Value',  handles.infor.readpoint);
        set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1*2/handles.infor.endpoint]);
        set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );
        fileinformation=strcat(num2str(round( handles.Gpsdatafile(val).bytes*2/16367667*1000 )),' ms');
        set(handles.statesbar2,'String',fileinformation);
    case '3'
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);
        end
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2|channel 3');
        set(handles.readpoints,'Max',handles.infor.endpoint);
        set(handles.readpoints,'Value',  handles.infor.readpoint);
        set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1/handles.infor.endpoint]);
        set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );
        fileinformation=strcat(num2str(round( handles.Gpsdatafile(val).bytes/16367667*1000 )),' ms');
        set(handles.statesbar2,'String',fileinformation);
    case '4'
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);
        end
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1|channel 2|channel 3|channel 4');
        set(handles.readpoints,'Max',handles.infor.endpoint);
        set(handles.readpoints,'Value',  handles.infor.readpoint);
        set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1/handles.infor.endpoint]);
        set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );
        fileinformation=strcat(num2str(round( handles.Gpsdatafile(val).bytes/16367667*1000 )),' ms');
        set(handles.statesbar2,'String',fileinformation);
    otherwise
        if handles.Gpsdatafile(val).bytes==0,
            handles.infor.endpoint=10000;
            handles.infor.readpoint=0;
        else
            handles.infor.endpoint=handles.Gpsdatafile(val).bytes*4/16367667*1000-2;
            handles.infor.readpoint=ceil(handles.infor.endpoint/2);
        end
        set(handles.popupmenu4,'value',1);
        set(handles.popupmenu4,'string','channel 1');
        set(handles.readpoints,'Max',handles.infor.endpoint);
        set(handles.readpoints,'Value',  handles.infor.readpoint);
        set(handles.readpoints,'Min',1,'SliderStep',[1/handles.infor.endpoint,1*4/handles.infor.endpoint]);
        set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms') );
        fileinformation=strcat(num2str(round( handles.Gpsdatafile(val).bytes*4/16367667*1000 )),' ms');
        set(handles.statesbar2,'String',fileinformation);
end

drawnow;
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function fileofcurrentdirectory_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fileofcurrentdirectory (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



% --- Executes on slider movement.
function readpoints_Callback(hObject, eventdata, handles)
% hObject    handle to readpoints (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider

val = get(handles.readpoints,'Value');
handles.infor.readpoint=round(val);
set(handles.readpointshow,'String',strcat( num2str(handles.infor.readpoint) ,' ms'));
guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function readpoints_CreateFcn(hObject, eventdata, handles)
% hObject    handle to readpoints (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on button press in startb.
function startb_Callback(hObject, eventdata, handles)
% hObject    handle to startb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.readfileb,'Enable','off');
set(handles.confirmb,'Enable','off');
set(handles.startb,'Enable','off');
drawnow;  
for counter=1:1:12,
    str=['set(handles.ch',num2str(counter),'r,''Enable'',''off'');'];
    eval(str);
    drawnow;
end
%initial condition
global IF
global UnitTime
global fs
global ts
global fo
global setting
set(handles.correlationstatuss,'String','Correlation is preparing');
drawnow;
initialcondition();
inputdata=handles.inputdata;
%do search function
channel=struct('satelliteID',0,...
    'Acqfrequence',0,...
    'Doppler',0,...
    'AcqCAphase',0,...
    'status','0');
chn=struct('channel',channel,'channelnum',0);
startpoint=1;
[chn.channel chn.channelnum]=search(inputdata,...
                                                        startpoint,...
                                                        handles.infor.searchbin,...
                                                        hObject, eventdata, handles);

if ~ishandle(handles.NS210),
    return;
end
handles.svnNo=0;
handles.chn=chn;
guidata(hObject, handles);
num=handles.chn.channelnum;
files=zeros(1,12);
for c1=1:num,
    files(c1)=(handles.chn.channel(c1). satelliteID);
end
for c2=num+1:1:12;
    files(c2)=0;
end

for counter=1:1:12,
    str1=['set(handles.ch',num2str(counter),'r,''String'',num2str(files(',num2str(counter),')),''Enable'',''on'');'];
    str2=['if files(',num2str(counter),')~=0,',...
        'set(handles.ch',num2str(counter),'r,''Background'',[0.5 1 0.5]);',...
        'end'];
    eval(str1);
    eval(str2);
    drawnow;
end
for counter=1:1:32,
    str=['set(handles.prn',num2str(counter),'cb,''Enable'',''on'');'];
    eval(str);
    drawnow;
end
set(handles.readfileb,'Enable','on');
set(handles.showphaseb,'Enable','on');
set(handles.selectallb,'Enable','on');
set(handles.confirmb,'Enable','on');
set(handles.startb,'Enable','off');
set(handles.showcorrb,'Enable','on');
set(handles.correlationstatuss,'String','Correlation finished');
drawnow;
guidata(hObject, handles);


% --- Executes on button press in showphaseb.
function showphaseb_Callback(hObject, eventdata, handles)
% hObject    handle to showphaseb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


set(handles.resultsstatuss,'String','Busy -- Showing C/A code Phase');
drawnow;                  
if handles.svnNo~=0;
    
    val=handles.svnNo; 
    svn=handles.chn.channel(val).satelliteID;
    phase=handles.chn.channel(val).AcqCAphase;

    position=(phase*1023/floor(16367667/1000));
    if position > 1023
    position = position - 1023;
    end
    
    scrsz = get(0,'ScreenSize');
    h=figure('Position',[scrsz(3)/4 scrsz(4)/4 scrsz(3)/2 scrsz(4)/2]);
    set(gcf,'NumberTitle','off','name','C/A code Phase');
    set(gcf,'menubar','none');
    set(h,'CloseRequestFcn','closereq');
    
    c=generatecacode(svn);
    t=1:1023;    
    subplot(3,1,1);
    stairs([1:2],c(1:2));
    axis([1 1023/3 -2 2]);
    title([' C/A code Phase ( PRN=',num2str(svn),' )']);
    hold on;
    pause(0.00001);
    for i=2:ceil(1023/3),        
            if ~ishandle(h),
               break
            else     
                set(0,'CurrentFigure',h);
                subplot(3,1,1); 
                stairs(t(i-1:i),c(i-1:i));
                axis([1 1023/3 -2 2]);
                hold on;
                if i==round(position),
                    stem(position,1.5 ,'r');
                    text(position+10,1.2,[num2str( round(position) )]);
                    hold on
                end
                if mod(i,10)==0,
                    pause(0.00001);
                end
            end
    end
   
    for i=ceil(1023/3):ceil(1023*2/3),
           if ~ishandle(h),
                   break;
           else
                set(0,'CurrentFigure',h);	subplot(3,1,2);
                stairs(t(i-1:i),c(i-1:i));
                axis([1023/3 1023*2/3 -2 2]);
                hold on; 
                if i==round(position),
                    stem(position,1.5 ,'r');
                    text(position+10,1.2,[num2str( round(position) )]);
                    hold on
                end
                if mod(i,10)==0,
                    pause(0.00001);
                end
           end
    end
  
     for i=ceil(1023*2/3):1023,
            if ~ishandle(h),
                    break;
            else 
                set(0,'CurrentFigure',h);	
                subplot(3,1,3);
                stairs(t(i-1:i),c(i-1:i)); 
                axis([1023*2/3 1023 -2 2]);
                hold on;
                if i==round(position),
                    stem(position,1.5 ,'r');
                    text(position+10,1.2,[num2str( round(position) )]);
                    hold on
                end
                if mod(i,10)==0,
                    pause(0.00001);
                end
            end
     end

zoom xon;
set(handles.resultsstatuss,'String','Ready');
drawnow;
else
    set(handles.resultsstatuss,'String','Ready');
    drawnow;
    errordlg('You have not done the correlation or chose the wrong Channel','Warning');
end

% --- Executes on button press in showcorrb.
function showcorrb_Callback(hObject, eventdata, handles)
% hObject    handle to showcorrb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.resultsstatuss,'String','Busy -- Showing Correlation Peak');drawnow;

if handles.svnNo~=0;
    
val=handles.svnNo;
svn=handles.chn.channel(val).satelliteID;
scrsz = get(0,'ScreenSize');
h2=figure('Position',[scrsz(3)/4 scrsz(4)/4 scrsz(3)/2 scrsz(4)/2]);

set(gcf,'NumberTitle','off',...
    'name','Correlation Peak');
set(gcf,'menubar','none');  

y=[1:21];
x=[1:16367];
z=double(handles.chn.channel(val).corrvalue);
z2 = z;
figure(h2);
if handles.infor.readtime==1,
z=double(handles.chn.channel(val).corrvalue);
else
z(:,16368:32735) = [];
z2(:,1:16368) = [];
z3 = z + z2;
end

if handles.infor.readtime==1,
mesh(x,y,z);
else
mesh(x,y,z3);
end
lighting phong
set(gca,'OuterPosition',[0.1 0.1 0.9 0.85]);
if handles.infor.readtime==1,
% axis([1 16367.667 1 211 -inf]);
axis([1 16367.667 1 21 1 10e+7]);
else
axis([1 16367.667 1 21 1 10e+8]);
end
% axis([1 16367.667 1 21 1 10e+7]);
yy=[1:2:21];
set(gca,'YTick',yy);
set(gca,'YTickLabel',{'-10',     '-8',      '-6',     '-4',     '-2',      '0',...
       '2',        '4',        '6',       '8',      '10'});
   

% realtime=16367/16367.667;
% chiptime=1/1023;
% realchip=realtime/chiptime;
% deta=16367/realchip;
% if handles.infor.readtime==1,
realtime=16367/16367.667;
chiptime=1/1023;
realchip=realtime/chiptime;
deta=16367/realchip;
chipposition=zeros(1,1022);
chipposition(1)=deta;
for counter=2:1022,
    chipposition(counter)=chipposition(counter-1)+deta;
end
counter2=1;
for counter=1:1022,
    if mod(counter,100)==0,
        selectedposition(counter2)=chipposition(counter);
        counter2=counter2+1;
    end
end

set(gca,'xtick',[chipposition(1) selectedposition(1:9), 16367.667]);
set(gca,'XTickLabel',{'1',      '100',      '200',    '300',     '400',     '500',   ...
   '600',       '700',      '800',      '900',        '1023'  });

set(gca,'PlotBoxAspectRatio',[2.5 2.5 1]);
xlabel('C/A Code Phase','Rotation',25 )
ylabel('Doppler frequency shift (KHz) ','Rotation',-35)
zlabel('Correlation Amplitude')
title('Correlation Peak');
%--------------------------------------------------------------------------<
dop=handles.chn.channel(val).Doppler/1000;
phase=handles.chn.channel(val).AcqCAphase*(realtime/16367)/chiptime;

[maxcorr freqNo  ]      =max(max( (handles.chn.channel( val).corrvalue)' ));
[maxcorr phasesampleNo]=max(max(handles.chn.channel( val).corrvalue));

averfloor=handles.chn.channel( val).corrvalue;
line=averfloor(:,phasesampleNo);
freqchose=find( (line/maxcorr)>0.8 );
row=averfloor(freqNo,:);
phasesamplechose=find( (row/maxcorr)>0.8 );
averfloor(freqchose,:)=0;
averfloor(:,phasesamplechose)=0;
averfloor=mean(mean(averfloor));
%-------------------------------------------------------------------------->
if phase > 1023.0,
phase = phase - 1023;
end
dop=num2str(dop,'%1.2f');
phase=num2str(phase,'%1.2f');
maxcorr=num2str(maxcorr,'%1.2f');
averfloor=num2str(averfloor,'%1.2f');

svn=strcat(' PRN =', num2str(svn));
dop=strcat(' DopplerFreq =',dop, 'KHz' );
phase=strcat(' CodePhase =',phase,   'chip');
maxcorr=strcat(' CorrPeak =',maxcorr);
averfloor=strcat(' AveFloor =',averfloor);

po=get(gcf,'position');
co=get(gcf,'color');
h_text=uicontrol(h2,'style','text',...
   'unit','normalized',...
      'horizontal','left',...
   'HorizontalAlignment','left',...
   'fontsize',10,...
   'Position',[0.0 0.0 0.30 0.25],...
   'string',{svn,dop,phase,maxcorr,averfloor});
set(h_text,'backgroundcolor',co);

set(handles.resultsstatuss,'String','Ready');

drawnow;
else
    set(handles.resultsstatuss,'String','Ready');
    drawnow;
    errordlg('You have not done the correlation or chose the wrong Channel','Warning');
end


% --- Executes on button press in showpsdb.
function showpsdb_Callback(hObject, eventdata, handles)
% hObject    handle to showpsdb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

str=get(handles.statusl,'String');
set(handles.statusl,'String','Busy -- Showing PSD');drawnow;

x=handles.inputdata;
x=double(x);
X=fft(x,16367);
Pxx=X.*conj(X)/16367667;
p=10*log10(Pxx);

scrsz = get(0,'ScreenSize');
figure('Position',[scrsz(3)/4 scrsz(4)/4 scrsz(3)/2 scrsz(4)/2])
set(gcf,'NumberTitle','off');
set(gcf,'name','Spectrum of the GPS Signal');
set(gcf,'menubar','none');  
plot(p);
hold on
stem(4.1284e+003,-11,'r');
hold off;
text(4.1284e+003,-12,'IF');

axis([1,length(p)/2,-50,2]);
title('PSD of the GPS Signal');
ylabel('PSD Magnitude (db)');
xlabel('Frequency (KHz)');
zoom xon;
set(handles.statusl,'String',str);
drawnow;


% --- Executes on button press in readfileb.
function readfileb_Callback(hObject, eventdata, handles)
% hObject    handle to readfileb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%read data


for counter=1:1:32,
    str=['set(handles.prn',num2str(counter),    'cb,''Value'',0,    ''Enable'',''off'');'];
    eval(str);
    drawnow;
end
bgcolor=get(gcf,'Color');
for counter=1:1:12,
    str=['set(handles.ch',num2str(counter),'r,''Enable'',''off'',   ''String'',''0'',   ''Background'',bgcolor);'];
    eval(str);
    drawnow;
end

set(handles.fileofcurrentdirectory,'Enable','off');
set(handles.readpoints,'Enable','off');
set(handles.readtime1msr,'Enable','off');
set(handles.readtime2msr,'Enable','off');
set(handles.readfileb,'Enable','off');
set(handles.showpsdb,'Enable','off');
set(handles.correlationstatuss,'String','Ready');
set(handles.selectallb,'Value',0,   'String','Select All',  'Enable','off'); 
set(handles.confirmb,'Enable','off');
set(handles.startb,'Enable','off');
set(handles.popupmenu4,'Enable','off');
set(handles.showphaseb,'Enable','off');
set(handles.showcorrb,'Enable','off');
drawnow;

global datatype;
datatype = get(handles.popupmenu4,'Value');
handles.inputdata=0;
rt=handles.infor.readtime;
[inputdata datanum]=readdata( hObject, eventdata, handles);
 if ~ishandle(handles.NS210),
             return;
 end
 inputdata=int8(inputdata);

handles.inputdata=inputdata;
rp=handles.infor.readpoint;

file=handles.infor.filename;
indices = strfind(file,'\');
file=file(indices(end)+1:end);
str=strcat('Data file :',file,' Current Data :',num2str(rt),    ' ms , Start at :',num2str(rp ),' ms');
set(handles.statusl,'String',str);
drawnow;

set(handles.fileofcurrentdirectory,'Enable','on');
set(handles.readpoints,'Enable','on');
set(handles.readtime1msr,'Enable','on');
set(handles.readtime2msr,'Enable','on');
set(handles.readfileb,'Enable','on');
set(handles.showpsdb,'Enable','on');
set(handles.cancelb,'Enable','on');
set(handles.popupmenu4,'Enable','on');

for counter=1:1:32,
    str=['set(handles.prn',num2str(counter),    'cb,    ''Enable'',''on'');'];
    eval(str);
    drawnow;
end

set(handles.selectallb,'Enable','on');
set(handles.confirmb,'Enable','on'); 
set(handles.startb,'Enable','off');
guidata(hObject, handles);


% --- Executes on button press in ch1r.
function ch1r_Callback(hObject, eventdata, handles)
% hObject    handle to ch1r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch1r
set(hObject,'Value',1);
me=1;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);


% --- Executes on button press in ch2r.
function ch2r_Callback(hObject, eventdata, handles)
% hObject    handle to ch2r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch2r
set(hObject,'Value',1);
me=2;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch3r.
function ch3r_Callback(hObject, eventdata, handles)
% hObject    handle to ch3r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch3r
set(hObject,'Value',1);
me=3;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch4r.
function ch4r_Callback(hObject, eventdata, handles)
% hObject    handle to ch4r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch4r
set(hObject,'Value',1);
me=4;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch5r.
function ch5r_Callback(hObject, eventdata, handles)
% hObject    handle to ch5r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch5r
set(hObject,'Value',1);
me=5;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch6r.
function ch6r_Callback(hObject, eventdata, handles)
% hObject    handle to ch6r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch6r
set(hObject,'Value',1);
me=6;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch7r.
function ch7r_Callback(hObject, eventdata, handles)
% hObject    handle to ch7r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch7r
set(hObject,'Value',1);
me=7;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch8r.
function ch8r_Callback(hObject, eventdata, handles)
% hObject    handle to ch8r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch8r
set(hObject,'Value',1);
me=8;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch9r.
function ch9r_Callback(hObject, eventdata, handles)
% hObject    handle to ch9r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch9r
set(hObject,'Value',1);
me=9;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch10r.
function ch10r_Callback(hObject, eventdata, handles)
% hObject    handle to ch10r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch10r
set(hObject,'Value',1);
me=10;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in ch11r.
function ch11r_Callback(hObject, eventdata, handles)
% hObject    handle to ch11r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch11r
set(hObject,'Value',1);
me=11;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);


% --- Executes on button press in ch12r.
function ch12r_Callback(hObject, eventdata, handles)
% hObject    handle to ch12r (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of ch12r
set(hObject,'Value',1);
me=12;
handles=channelchose(me,hObject, eventdata, handles);
guidata(hObject, handles);

% --- Executes on button press in cancelb.
function cancelb_Callback(hObject, eventdata,  handles)
% hObject    handle to cancelb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.cancelb,'Enable','off');
selection = questdlg('Close NewStar 210M GPS Signal Processor?',...
                     'Close',...
                     'Yes','No','Yes');
                 drawnow;
switch selection,
   case 'Yes',       
    delete(gcf)
   case 'No'
       set(handles.cancelb,'Enable','on');
     return
end
drawnow;

function [channel channelnum]=search(inputdata,startpoint,searchtime,hObject, eventdata, handles);
%a search function which if for acquisition after reading GPS raw data 
%要考虑到在载波之外还有CA码的多普勒频移

%inputdata          is the raw digitized binary GPS data
%startpoint         is the startpoint of the read data 
%searchtime       is the search time

%channel            is the available SV's ID and other information
%channelnum     is the number of the channel

%Created 4/15/05, Hao Yu, [email protected] 
%Copy right olinkstar corp. Bejing China

global IF
global UnitTime
global fs
global ts
global fo
global setting

datanum=fix(searchtime*fs/1000);
num=[0:datanum-1];
inputdata=double(inputdata);
inputdataf=fft(inputdata(startpoint:startpoint+datanum-1),16367);              %**得到各频率谱线
inputdataf(1)=0;                             %**消除直流成分

%******产生本地码,C/A码和RF的乘积后进行环形相关
string='Correlating : ';
for svID=1:32, 
    if handles.svchose(svID)==1,        
        if ~ishandle(handles.NS210),
             break;
        end
        
        CAsample=3*sampleCAcode(svID,fs,searchtime );          %**按照fs采样CA码
        fcas=fft(CAsample);
   
        maxno=21;
        for counter=1:1:maxno,      %-10k到10k的多普勒频移
            dopshift=(counter-1)-fix(maxno/2);
            fi=fo+dopshift*500;    %加多普勒偏移后的频率
            carrier=exp(j*2*pi*fi*num*ts);
            cosine= real(carrier);
            sine   =imag(carrier);
            I =inputdata.*cosine;   %信号也分了两相
            Q =inputdata.*sine;
            fiq=fft(I+Q*j);%此后的fft
            out(counter,:)=abs(ifft( (fcas.* conj(fiq)))).^2;%还是相关
            
            percent=num2str( round( (svID/32)*100 ) );
            s=strcat(string,' PRN : ',num2str(svID),' -- Doppler : ',num2str(dopshift) );
            if ~ishandle(handles.NS210),
                break;
            end
            set(handles.correlationstatuss,'String',s);drawnow;
        end

        [maxAmp dopno]=max(max(out'));%dopno为最大的哪个频移
        [maxAmp phano]=max(max(out ));%freqno为最大的那个相位
        temp=out(dopno,:);
        temp(phano-10:phano+10)=[];
   
        if maxAmp/mean(temp)>17,

            CAsample2=[CAsample(phano:datanum) CAsample(1:phano-1)];

            dopshift1=(dopno-1)-fix(maxno/2);
            fic=fo+dopshift1*500;%根据粗相关得到的粗中频fi coarse

            stripcode=CAsample2.*inputdata;%去掉ca码
            maxno=21;
            for counter=1:1:maxno,      %-1000到1000的多普勒频移,精度为50hz
                dopshift=(counter-1)-fix(maxno/2);
                fi=fic+dopshift*50;    %加多普勒偏移后的频率
                carrier=exp(j*2*pi*fi*num*ts);
                cosine= real(carrier);
                sine   =imag(carrier);
                I   =stripcode.*cosine;   %信号也分了两相
                Q =stripcode.*sine;
                squaresum(counter)=sum(I').^2+sum(Q').^2;
          
                s=strcat(s,' .');
                if ~ishandle(handles.NS210),
                    break;
                end
                set(handles.correlationstatuss,'String',s);
                drawnow;

            end
            [maxAmp dopno]=max(squaresum);%dopno为最大的哪个频移
            
            channel(setting.nextchannel).corrvalue=out;
            channel(setting.nextchannel).satelliteID=svID;
            channel(setting.nextchannel).Acqfrequence=fic+((dopno-1)-fix(maxno/2))*50;
            channel(setting.nextchannel).Doppler=((dopno-1)-fix(maxno/2))*50+dopshift1*500;
            channel(setting.nextchannel).AcqCAphase=phano;
%             if(channel(setting.nextchannel).AcqCAphase > 1023)
%             channel(setting.nextchannel).AcqCAphase = channel(setting.nextchannel).AcqCAphase - 1024;
%             end
            
            channel(setting.nextchannel).status='p';
            setting.nextchannel=setting.nextchannel+1;
        end
    end
end
channelnum=setting.nextchannel-1;
%fprintf('\n');
if channelnum==0;
    channel=0;
end


% --- Executes on button press in selectallb.
function selectallb_Callback(hObject, eventdata, handles)
% hObject    handle to selectallb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

button_state = get(hObject,'Value');
if button_state == get(hObject,'Max')    % toggle button is pressed
    set(hObject,'String','Delete All');
    drawnow;
    for counter=1:1:32,
        str=['set(handles.prn',num2str(counter),'cb,''Value'',1);'];
        eval(str);
        drawnow;
    end
elseif button_state == get(hObject,'Min')    % toggle button is not pressed
    set(hObject,'String','Select All');
    drawnow;
    for counter=1:1:32,
        str=['set(handles.prn',num2str(counter),'cb,''Value'',0);'];
        eval(str);
        drawnow;
    end
end
guidata(hObject, handles);


% --- Executes on button press in confirmb.
function confirmb_Callback(hObject, eventdata, handles)
% hObject    handle to confirmb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
tempstr=get(handles.correlationstatuss,'String');

set(handles.confirmb,'Enable','off');
set(handles.correlationstatuss,'String','PRNs are chosen');
svchose=zeros(1,32);
for counter=1:1:32,
    str=['svchose(',num2str(counter),')=get(handles.prn',num2str(counter),'cb,''Value'');'];
    eval(str);
end
handles.svchose=svchose;
str=num2str(find(svchose==1));
if length(str)==0,
    questdlg('PRN has NOT been chosen !','Warning','Yes','Yes');
    set(handles.confirmb,       'Enable', 'on');  
else
    
    selection = questdlg(str,   'PRNs selected',...
                                          'Yes','No',...
                                          'Yes');
                 switch selection,
                     case 'Yes',                         
                         for counter=1:1:32,
                             str=['set(handles.prn',num2str(counter),'cb,''Enable'',''off'');'];
                             eval(str);
                             drawnow;
                         end
                         bgcolor=get(gcf,'Color');                         
                         for counter=1:1:12,
                             str=['set(handles.ch',num2str(counter),'r, ''String'',0, '...
                                                                                     ' ''Enable'',''off'', '...
                                                                              ' ''Background'',bgcolor, '...
                                                                                       ' ''Value'',0); '];
                             eval(str);
                             drawnow;
                         end
                         set(handles.selectallb,      'Enable','off');
                         set(handles.confirmb,       'Enable', 'off');  
                         set(handles.startb,           'Enable', 'on');
                         set(handles.showphaseb, 'Enable', 'off');
                         set(handles.showcorrb,    'Enable',  'off');
                         drawnow;
                     case 'No'
                         set(handles.confirmb,       'Enable', 'on');
                         set(handles.correlationstatuss,'String',tempstr);
                 end
end
drawnow;
guidata(hObject, handles);


% --- Executes on button press in readtime1msr.
function readtime1msr_Callback(hObject, eventdata, handles)
% hObject    handle to readtime1msr (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of readtime1msr
set(hObject,'Value',1);
set(handles.readtime2msr,'Value',0);
drawnow;

handles.infor.readtime=1;
handles.infor.searchbin=handles.infor.readtime;
set(handles.readtimeshow,'String',strcat( num2str(handles.infor.readtime) ,'ms') );
guidata(hObject, handles);

% --- Executes on button press in readtime2msr.
function readtime2msr_Callback(hObject, eventdata, handles)
% hObject    handle to readtime2msr (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of readtime2msr
set(hObject,'Value',1);
set(handles.readtime1msr,'Value',0);
drawnow;

handles.infor.readtime=2;
handles.infor.searchbin=handles.infor.readtime;
set(handles.readtimeshow,'String',strcat( num2str(handles.infor.readtime) ,'ms') );
guidata(hObject, handles);

%*******************to get available file list in current directory
function handles=getfile(hObject, eventdata, handles)

files=dir;
c2=1;
longest=length(files);
for c=1:longest,
    [pathstr,files(c).name2,files(c).ext,versn] = fileparts(files(c).name);
    if(strcmp(files(c).ext,'.dat')),
        datafile(c2)=files(c);
        c2=c2+1;
    end
end
if c2==1,
    datafile.name='No available file in current directory';
    datafile.bytes=0;
    set(handles.readfileb,'Enable','off');
else
    set(handles.readfileb,'Enable','on');
end
handles.Gpsdatafile=datafile;
guidata(hObject,handles);
filelist=[];%get the file list in the pop-up menu
for c=1:length(datafile),
    filelist=strcat(filelist,datafile(c).name,'|');
end
filelist(length(filelist))=[];%去掉最后一个'|'
set(handles.fileofcurrentdirectory,'String',filelist);
guidata(hObject,handles);

%********************get the channel No, when the radio button was chosen
function handles=channelchose(me,hObject, eventdata, handles)

for counter=1:1:12,
    if counter~=me;
        str=['set(handles.ch',num2str(counter),'r,''Value'',0);'];
        eval(str);
        drawnow;
    end
end

val =str2num( get(handles.ch1r,'String'));
str=['val=str2num(get(handles.ch',num2str(me),'r,''String''));'];
eval(str);
if val~=0,
    if (get(hObject,'Value') == get(hObject,'Max'))
    handles.svnNo=me;
    else
    % radio button is not selected-take approriate action
    end
else
    handles.svnNo=0;
end
guidata(hObject,handles);


% --- Executes on button press in prn1cb.
function prn1cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn1cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn1cb

% --- Executes on button press in prn2cb.
function prn2cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn2cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn2cb


% --- Executes on button press in prn3cb.
function prn3cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn3cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn3cb


% --- Executes on button press in prn4cb.
function prn4cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn4cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn4cb


% --- Executes on button press in prn5cb.
function prn5cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn5cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn5cb


% --- Executes on button press in prn6cb.
function prn6cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn6cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn6cb


% --- Executes on button press in prn7cb.
function prn7cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn7cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn7cb


% --- Executes on button press in prn8cb.
function prn8cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn8cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn8cb


% --- Executes on button press in prn9cb.
function prn9cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn9cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn9cb


% --- Executes on button press in prn10cb.
function prn10cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn10cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn10cb


% --- Executes on button press in prn11cb.
function prn11cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn11cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn11cb


% --- Executes on button press in prn12cb.
function prn12cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn12cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn12cb


% --- Executes on button press in prn13cb.
function prn13cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn13cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn13cb


% --- Executes on button press in prn14cb.
function prn14cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn14cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn14cb


% --- Executes on button press in prn15cb.
function prn15cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn15cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn15cb


% --- Executes on button press in prn16cb.
function prn16cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn16cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn16cb


% --- Executes on button press in prn17cb.
function prn17cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn17cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn17cb


% --- Executes on button press in prn18cb.
function prn18cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn18cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn18cb


% --- Executes on button press in prn19cb.
function prn19cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn19cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn19cb


% --- Executes on button press in prn20cb.
function prn20cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn20cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn20cb


% --- Executes on button press in prn21cb.
function prn21cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn21cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn21cb


% --- Executes on button press in prn22cb.
function prn22cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn22cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn22cb


% --- Executes on button press in prn23cb.
function prn23cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn23cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn23cb


% --- Executes on button press in prn24cb.
function prn24cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn24cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn24cb


% --- Executes on button press in prn25cb.
function prn25cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn25cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn25cb


% --- Executes on button press in prn26cb.
function prn26cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn26cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn26cb


% --- Executes on button press in prn27cb.
function prn27cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn27cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn27cb


% --- Executes on button press in prn28cb.
function prn28cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn28cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn28cb


% --- Executes on button press in prn29cb.
function prn29cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn29cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn29cb


% --- Executes on button press in prn30cb.
function prn30cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn30cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn30cb


% --- Executes on button press in prn31cb.
function prn31cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn31cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn31cb



% --- Executes on button press in prn32cb.
function prn32cb_Callback(hObject, eventdata, handles)
% hObject    handle to prn32cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of prn32cb


% --- Executes on selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu4 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu4
global datatype;
datatype = get(hObject,'Value');


% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes during object creation, after setting all properties.
function statesbar2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to statesbar2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object deletion, before destroying properties.
function statesbar2_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to statesbar2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



猜你喜欢

转载自blog.csdn.net/jimmyisme/article/details/78559451
今日推荐