From: Judas Magnus on 1 Apr 2010 20:07 I want to extract the first name and last name. %I enter a name joe blue a = input('Put a name:'); I want to use the strtrim(roster) to remove spaces. for k=1:length(roster(:,1)) %for the amount of colums in roster value=isspace(roster(row,:)); if strtrim(roster) rowExtraction=roster(row,:) %Now i want to extract the first name into a varible called First, and extract the last name to a variable called Last. end
From: Matt Fig on 1 Apr 2010 21:12 a = input('Put a name:'); first = regexp(a,'\w+','match'); [first,last] = first{:}
From: Judas Magnus on 1 Apr 2010 21:47 is there a way to make regexp work for more than one dimensional? If i enter another name, i get "??? Error using ==> regexp The first argument (STRING) must be a one-dimensional array of char or cell arrays of strings. "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hp3g96$18d$1(a)fred.mathworks.com>... > a = input('Put a name:'); > first = regexp(a,'\w+','match'); > [first,last] = first{:}
From: Judas Magnus on 1 Apr 2010 21:48 is there a way to make regexp work for more than one dimensional? If i enter another name, i get "??? Error using ==> regexp The first argument (STRING) must be a one-dimensional array of char or cell arrays of strings. "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hp3g96$18d$1(a)fred.mathworks.com>... > a = input('Put a name:'); > first = regexp(a,'\w+','match'); > [first,last] = first{:}
From: Matt Fig on 1 Apr 2010 23:23 What do you mean, "if I enter another name"? Do you mean that you enter a list at one INPUT prompt or you repeated call INPUT in a loop? Show what you mean.....
|
Next
|
Last
Pages: 1 2 Prev: PDE coefficients as row vector Next: data gridding on a 2-d mesh with voids |