From: beginner on
I have a pathname with the following:

C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\

I would like to save the 3 strings from this:
var1 = 'LM Files'
var2 = 'TEST_01'
var3 = '01'

Is there any way to do this using strread or something else? I have
tried using strread, but have been unsuccessful.
From: us on
beginner <beginner1.mat(a)hotmail.com> wrote in message <b28a722b-f0f2-494c-806a-ef0c7bb8b229(a)n19g2000prf.googlegroups.com>...
> I have a pathname with the following:
>
> C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\
>
> I would like to save the 3 strings from this:
> var1 = 'LM Files'
> var2 = 'TEST_01'
> var3 = '01'
>
> Is there any way to do this using strread or something else? I have
> tried using strread, but have been unsuccessful.

one of the solutions

s='C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\';
r=regexp(s,'\\','split');
disp(r.');
%{
'C:' % <- r{1}
'Documents and Settings' % <- r{2}
'LM Files'
'ALL'
'TEST_01'
'NEW' % <- r{6}
'' % <- r{7}
%}
% now, select the parts you need...

us
From: beginner on
On Aug 6, 12:46 pm, "us " <u...(a)neurol.unizh.ch> wrote:
> beginner <beginner1....(a)hotmail.com> wrote in message <b28a722b-f0f2-494c-806a-ef0c7bb8b...(a)n19g2000prf.googlegroups.com>...
> > I have a pathname with the following:
>
> > C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\
>
> > I would like to save the 3 strings from this:
> > var1 = 'LM Files'
> > var2 = 'TEST_01'
> > var3 = '01'
>
> > Is there any way to do this using strread or something else?  I have
> > tried using strread, but have been unsuccessful.
>
> one of the solutions
>
>      s='C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\';
>      r=regexp(s,'\\','split');
>      disp(r.');
> %{
>     'C:'     % <- r{1}
>     'Documents and Settings'     % <- r{2}
>     'LM Files'
>     'ALL'
>     'TEST_01'
>     'NEW'     % <- r{6}
>     ''     % <- r{7}
> %}
> % now, select the parts you need...
>
> us

Wow...didn't know something like this existed...thank you so much!!!!
From: dk on
On Aug 7, 12:46 am, "us " <u...(a)neurol.unizh.ch> wrote:
> beginner <beginner1....(a)hotmail.com> wrote in message <b28a722b-f0f2-494c-806a-ef0c7bb8b...(a)n19g2000prf.googlegroups.com>...
> > I have a pathname with the following:
>
> > C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\
>
> > I would like to save the 3 strings from this:
> > var1 = 'LM Files'
> > var2 = 'TEST_01'
> > var3 = '01'
>
> > Is there any way to do this using strread or something else?  I have
> > tried using strread, but have been unsuccessful.
>
> one of the solutions
>
>      s='C:\Documents and Settings\LM Files\ALL\TEST_01\NEW\';
>      r=regexp(s,'\\','split');
>      disp(r.');
> %{
>     'C:'     % <- r{1}
>     'Documents and Settings'     % <- r{2}
>     'LM Files'
>     'ALL'
>     'TEST_01'
>     'NEW'     % <- r{6}
>     ''     % <- r{7}
> %}
> % now, select the parts you need...
>
> us

r=regexp(s,'\\','split'); and r=regexp(s,'\','split'); are't the
same?

From: us on
dk <mcdivyakanth(a)gmail.com>
> r=regexp(s,'\\','split'); and r=regexp(s,'\','split'); are't the
> same?

yes, just being a purist:
- while they both work (fortuitously), the official backslash character representation is

\\

% see also
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f0-42649.html#f0-42808

us