## Copyright (C) 2009 Thomas Weidenfeller
## 
## This file is part of gds2000tools/gds-octave.
## 
## gds2000tools/gds-octave is free software: you can redistribute it
## and/or modify it under the terms of the GNU General Public License
## version 3 as published by the Free Software Foundation.
## 
## gds2000tools/gds-octave is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with gds2000tools/gds-octave.  If not,
## see <http://www.gnu.org/licenses/>.
##

## Deprecated
##
## usage: [V] = gds_wd2v(GDSSTRUCT)
## usage: [V] = gds_wd2v(GDSSTRUCT, OFFFLAG)
## usage: [V] = gds_wd2v(WDATA, VSCALE)
##
## Returns the Waveform Data samples from GDSSTRUCT as voltage values.
## Or returns the data in the WDATA matrix as voltage values.
##
## The function takes the Vertical Scale information in GDSSTRUCT and
## the GDS-2000 oscilloscope 25 samples/div scaling constant into account.
##
## OFFLAG, when true, indicates that also the Vertical Position
## information should be taken into account. This offsets all values by the
## Vertical Position value. This is primarily interesting for display. The
## values calculated with the offset in mind are not suitable for calculations.
##
## Note: The function name is a misnomer. Therefore the function is
##       deprecated. Use
##
##       gds_struct2val  to convert data from a GDSSTRUCT to (voltage)
##                       values,
##       gds_wd2val      to convert waveform data to (voltage) values.
##
## Example:
##
## gs = gds_csvread("DS0012.CSV");
## v = gds_wd2v(gs);
##
## See also: gds_csvread, gds_plot, gds_plotspectrum, gds_struct2val, gds_w2val.

## Author: Thomas Weidenfeller
## Created: 2009-07-17
## Version: $Id: gds_wd2v.m,v 1.3 2010/07/10 21:13:40 tw Exp $
## Keywords: Oscilloscope, GDS-2000, gds2000tools, plot

function [v] = gds_wd2v(arg1, arg2)
	if(nargin < 1)
		print_usage();
	endif

	if(isstruct(arg1)) 
		##
		## Old gds_wd2v behavior
		##
		if(!strcmp(gs.Vertical_Units, "V"))
			warning("Vertical sampling unit is not 'V' (Volts), but '%s'.", gs.Vertical_Units);
		endif
		v = gds_struct2val(arg1, arg2);
	else
		v = gds_wd2val(arg1, arg2);
	endif
endfunction
