function LogButton_Callback(src,eventdata)
global log_fd;
global PS_log_fd;

if(log_fd == -1)
    log_fd = fopen('PC_log.dat','w');
    PS_log_fd = fopen('PS_log.dat','w');    
    if((log_fd > 2) && (PS_log_fd > 2))  %Successful opening of file
      src.String = 'Stop Logging';
    end
else
  fclose(log_fd);
  fclose(PS_log_fd);
  log_fd = -1;
  PS_log_fd = -1;
  src.String = 'Start Logging';

end