function [field,x,y]=hopsgui_2dslice(filein,time,var)

%       USAGE: [field,x,y]=hopsgui_2dslice(filein,time,var)
%
% HOPS_2DSLICE  Returns a matrix containing de 2-dimensional
%   field from the variable vara horizontal slice (field) and position (x,y) 
%   at a given time step from an HOPS output (PE) file.
% inputs: 	
% 		filein -- the .nc file
% 		time -- time of teh simulatio
%		var -- string with the variable name
%
%  Pedro Velez (UIB), July 1999




vargrid='tgrid2';
x=getnc(filein,vargrid,[-1 -1 1],[-1 -1 1],1,1,2);
y=getnc(filein,vargrid,[-1 -1 2],[-1 -1 2],1,1,2);
field=getnc(filein,var,[time -1 -1],[time -1 -1],1,1,2);
