What function returns some number of characters on the right or left of a string? i.e. if I have the string 'filename', is there a command like Left('filename',4) = file? Thanks.
asdd12 wrote: > > > What function returns some number of characters on the right or > left > of a string? i.e. if I have the string 'filename', is there a > command > like Left('filename',4) = file? Thanks. >> f='filename' f = filename >> f(1:4) ans = file
In article <ef4d6a8.-1@webcrossing.raydaftYaTP>, nospam@nospam.com says... > What function returns some number of characters on the right or left > of a string? i.e. if I have the string 'filename', is there a command > like Left('filename',4) = file? Thanks. > f = 'filename' left4 = f(1:4) Read "Getting Started with MATLAB" --Loren http://blogs.mathworks.com/loren/
asdd12: <SNIP a leftist... > What function returns some number of characters on the right or left of a string one of the many solutions % the outset s='1234-5678'; nl=4; % the engine if nl <= length(s) s=s(1:nl); % -or- depending upton the size of <s> and <nl> % s(nl+1:end)=''; end % the result s us