No BSD License
Highlights from
strrepx
from
strrepx
by Mathias Benedek
Replace string with another in any location of a mixed cell/struct - data structure
|
| strrepx(v, s1, s2)
|
function v = strrepx(v, s1, s2)
%STRREPX Replace string with another in any location of a mixed cell/struct - data structure.
% v = STRREPX(v,s1,s2) replaces all occurrences of the string s1 in
% the variable v with the string s2. The new variable is returned.
%
% It recursively searches v for strings and applies the MATLAB function strrep on them.
%
% By Mathias Benedek, 2007-03-10
% Updated version (V1.1) based on feedback by Bart Roossien
global nstrrep
if isempty(v)
elseif ischar(v) | iscellstr(v)
v = strrep(v, s1, s2);
elseif iscell(v)
v = cellfun(@(v) (strrepx(v,s1,s2)), v, 'UniformOutput', false);
elseif isstruct(v)
v = structfun(@(v) (strrepx(v,s1,s2)), v, 'UniformOutput', false);
end
|
|
Contact us at files@mathworks.com