%
% File:   vgetdat.m
% Date:   06-Jan-99
% Author: I. Chuang <ike@isl.stanford.edu>
%
% Matlab program: interface with vnmr
%
% Get data from a specified experiment and save it in the vnmrsys directory
% convert and plot data using v2sdat.
%
% Usage: vgetdat(expno,saveexpno)

function vgetdat(expno,expout)

unix('sleep 4')        % to avoid writing the data away before 
                       % VNMR finishes processing them

if(nargin<2)
  expout = expno;
end

fprintf(1,'[%s] getting data for exp%d...\n',mydate,expout);
[r,s] = unix(['getdata ' num2str(expno)]);	% get data using vnmrlink

expname = ['vnmrsys/exp' num2str(expout)];	% where to store it
unix(['rm -rf ' expname]);			% delete old data
unix(['mv exp' num2str(expno) ' ' expname]);	% move new data into place

% !ls vnmrsys/exp1/acqfil
% s = unix('sleep 4');
% fprintf(1,'[%s] Ok! fourier transforming exp%d\n',mydate,expout);
% v2sdat(expout);		% read in and FFT, and store as sd structure
% drawnow;
