Home > general > string_fun > mkvar.m

mkvar

PURPOSE ^

MKVAR Make char string into valid variable name.

SYNOPSIS ^

function stringout = mkvar(stringin,varargin);

DESCRIPTION ^

MKVAR   Make char string into valid variable name.

 stringout = mkvar(stringin)
 Replaces everything in s1 that's not a letter or digit with '_'
 so s2 can be used as variable name or as fieldname in a struct.

 If necesarry the first position is filled with 'x' rather than '_'.
 stringout = mkvar(stringin,letter) replaces the first position with the 
 user specified letter.

 stringout = mkvar(stringin,letter,'add'/'replace') replaces / adds first
 character, default 'add'.

 Idea: Howard E. Motteler form http://www.csee.umbc.edu/%7Emotteler/index.html

 See also: ISLETTER, MKTEX, MKHTML

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Mon 29-Nov-2010 15:42:51 by m2html © 2005