# v_winenvar

## PURPOSE

V_WINENVAR get windows environment variable [D]=(N)

## SYNOPSIS

function d=v_winenvar(n)

## DESCRIPTION

    V_WINENVAR get windows environment variable [D]=(N)

     Inputs: N  name of environment variable (e.g. 'temp')

     Outputs: D  value of variable or [] is non-existant

     Notes: (1) This is WINDOWS specific and needs to be fixed to work on UNIX
            (2) The search is case insensitive (like most of WINDOWS).

     Examples: (1) Open a temporary text file:
                   d=winenar('temp'); fid=fopen(fullfile(d,'temp.txt'),'wt');

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- v_voicebox V_VOICEBOX set global parameters for Voicebox functions Y=(FIELD,VAL)

## SOURCE CODE

    0001 function d=v_winenvar(n)
    0002 %V_WINENVAR get windows environment variable [D]=(N)
    0003 %
    0004 % Inputs: N  name of environment variable (e.g. 'temp')
    0005 %
    0006 % Outputs: D  value of variable or [] is non-existant
    0007 %
    0008 % Notes: (1) This is WINDOWS specific and needs to be fixed to work on UNIX
    0009 %        (2) The search is case insensitive (like most of WINDOWS).
    0010 %
    0011 % Examples: (1) Open a temporary text file:
    0012 %               d=winenar('temp'); fid=fopen(fullfile(d,'temp.txt'),'wt');
    0013
    0014 %   Copyright (c) 2005 Mike Brookes,  mike.brookes@ic.ac.uk
    0015 %      Version: $Id: v_winenvar.m 10865 2018-09-21 17:22:45Z dmb $
    0016 %
    0017 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0018 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0019 %
    0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0021 %   This program is free software; you can redistribute it and/or modify
    0022 %   it under the terms of the GNU Lesser General Public License as published by
    0023 %   the Free Software Foundation; either version 3 of the License, or
    0024 %   (at your option) any later version.
    0025 %
    0026 %   This program is distributed in the hope that it will be useful,
    0027 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0028 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0029 %   GNU Lesser General Public License for more details.
    0030 %
    0031 %   You can obtain a copy of the GNU Lesser General Public License from
    0032 %   https://www.gnu.org/licenses/ .
    0033 %
    0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0035 p=['%',n,'%'];
    0036 [s,d]=system(['echo ',p]);
    0037 while d(end)<=' ';
    0038     d(end)=[];
    0039 end
    0040 if strcmp(d,p)
    0041     d=[];
    0042 end