|
Contents | Previous | Next | Subchapters |
| Syntax |
str2strdir(oldstr, ...newstr, ...olddir, ...newdir, ...logfile,...oldext, ...newext, ...space ...
|
| See Also | fullpath , filediff |
oldstr
newstr
The arguments oldstr and newstr
are character matrices with the same row dimension
which we denote by m.
Let s1, s2, ... , sm be the rows in
oldstr not including trailing blanks.
Let n1, n2, ... , nm be the rows in
newstr not including trailing blanks.
The text conversions are
s1 | -> |
n1 |
s2 | -> |
n2 |
| ... | ... | ... |
sm | -> |
nm
|
s2 can include part of n1.
olddir
is a character row vector specifying the name of the old directory.
This directory must exist when str2strdir is called.
All of the files and directories in this directory will be copied
and converted in the new directory.
newdir
is a character row vector specifying the name of the new directory.
This directory must not exist when str2strdir is called.
The parent directory of newdir
must exist or else newdir can not be created.
logfile
is a character row vector specifying the name of the file in which
a log of the changes is written. If this file already exists, it
is first deleted and then a new log is written. The new and old version
of every line that is changed is written in the log file together with
the name of the name of the modified file.
oldext
is a character matrix. Each row of the matrix contains an file extension
that should be included in the conversion. All files that have extensions
that appear in oldext will be converted. Other files will just
be copied from the old to new directory.
newext
This argument is optional and need not appear in the calling syntax.
If it is present, it is a character matrix with the same number
of rows as oldext.
All files that have extensions that appear in oldext
will not only be edited as specified above.
In addition, they will also be converted
to have the corresponding extension specified by newext.
space
This argument is optional and need not appear in the calling syntax.
If it is present, it is a character scalar specifying a character in
newstr that should be output as a space.
Because trailing spaces are removed before using each row of newstr,
it is not possible to specify trailing spaces using newstr.
The space argument can be used for this purpose.
*.oms
instead of the extension *.mat.
In addition, the command matlab ( MATLAB® ) has been changed
to mlmode.
It is no longer necessary,
or suggested,
that directories be in include commands.
In addition, some functions that were previously *.mat files,
have been converted to intrinsic functions.
The following example creates a directory called
c:\temp\programs
in which all of the
*.mat, *.oms, and *.omh
files in or below the directory
c:\omwin\programs
have been converted from the old O-Matrix source code conventions
to the new conventions:
clear
oldstr = { ...
".mat", ... Old default extension
".MAT", ...
"matlab", ... Old command for Mlmode
...
"include function\", ... Old specification of library
"include lib\", ...
"include toolbox\", ...
...
"include ncols.oms", ... Version 5.1 *.oms files
"include inv.oms", ... Version 5 *.mat library files
"include conj.oms", ...
"include imag.oms", ...
"include floor.oms", ...
"include isfinite.oms", ...
"include isinf.oms", ...
"include isnan.oms", ...
"include up2low.oms", ...
"include low2up.oms", ...
"include any.oms", ...
"include all.oms", ...
"include mod.oms", ...
"include snormal.oms", ... Older *.mat library files
"include cholesky.oms" ...
}
newstr = { ...
".oms", ... New default extension
".OMS", ...
"mlmode", ... New mlmode command
...
"include@", ... No longer should specify library
"include@", ...
"include@", ...
...
"# include ncols", ... Version 5.1 intrinsic functions
"# include inv", ... Version 5 intrinsic functions
"# include conj", ...
"# include imag", ...
"# include floor", ...
"# include isfinite", ...
"# include isinf", ...
"# include isnan", ...
"# include up2low", ...
"# include low2up", ...
"# include any", ...
"# include all", ...
"# include mod", ...
"# include snormal", ... Now intrinsic functions
"# include cholesky" ...
}
olddir = "c:\omwin\programs"
newdir = "c:\temp\programs"
logfile = "str2strdir.log"
oldext = { ...
".mat", ...
".oms", ...
".omh" ...
}
newext = { ...
".oms", ...
".oms", ...
".omh" ...
}
space = "@" # character in newstr that is convert to a space
str2strdir( ...
oldstr, ...
newstr, ...
olddir, ...
newdir, ...
logfile, ...
oldext, ...
newext, ...
space ...
)
str2strdir will try to make the replacement
an infinite number of times.
This is why the extension has been dropped
from the file specifications in the commented out
include commands in the example above.