function [x,sNorm] = som_norm_variable(x, method, operation)
%SOM_NORM_VARIABLE Normalize or denormalize a scalar variable.
%
% [x,sNorm] = som_norm_variable(x, method, operation)
%
% xnew = som_norm_variable(x,'var','do');
% [dummy,sN] = som_norm_variable(x,'log','init');
% [xnew,sN] = som_norm_variable(x,sN,'do');
% xorig = som_norm_variable(xnew,sN,'undo');
%
% Input and output arguments:
% x (vector) a set of values of a scalar variable for
% which the (de)normalization is performed.
% The processed values are returned.
% method (string) identifier for a normalization method: 'var',
% 'range', 'log', 'logistic', 'histD', or 'histC'.
% A normalization struct with default values is created.
% (struct) normalization struct, or an array of such
% (cellstr) first string gives normalization operation, and the
% second gives denormalization operation, with x
% representing the variable, for example:
% {'x+2','x-2}, or {'exp(-x)','-log(x)'} or {'round(x)'}.
% Note that in the last case, no denorm operation is
% defined.
% operation (string) the operation to be performed: 'init', 'do' or 'undo'
%
% sNorm (struct) updated normalization struct/struct array
%
% For more help, try 'type som_norm_variable' or check out online documentation.
% See also SOM_NORMALIZE, SOM_DENORMALIZE.
%%%%%%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% som_norm_variable
%
% PURPOSE
%
% Initialize, apply and undo normalizations on a given vector of
% scalar values.
%
% SYNTAX
%
% xnew = som_norm_variable(x,method,operation)
% xnew = som_norm_variable(x,sNorm,operation)
% [xnew,sNorm] = som_norm_variable(...)
%
% DESCRIPTION
%
% This function is used to initialize, apply and undo normalizations
% on scalar variables. It is the low-level function that upper-level