Prev: Why isn't [] considered empty?
Next: global variable
From: Alberto on 5 Aug 2010 16:20 I am not sure if this is the right forum so please feel free to move. Here is my question: Lets imagine I have a variable people that is a Cell Array of names and ages: people = {'Mr Joe Shmoe 34', 'Mrs Who Ha 30', 'Dr Jim Jam 58' 'Ms Twinky Pinky 7'}' So in the command window, people will look like: people = 'Mr Joe Shmoe 34' 'Mrs Who Ha 30' 'Dr Jim Jam 58' 'Ms Twinky Pinky 7' If I want to split the cell so that I know the first part is the personTitle, second is firstName, third is surName, and last item is the their age, I could construct a new variable step1 = regexp(people, ' ', 'split'); this returns a new <4x1 Cell> step1 = {1x3 cell} {1x3 cell} {1x3 cell} {1x3 cell} Now my question is how do I "reshape" this variable step1 to create a new variable step2 which is a cell of dimension <4x4> so that the first column is the personTitle, the second colum is the firstName, etc... and the rows correspond to each persons details? Many thanks and kind regards, Alberto p.s. the e-mail address is a little cryptic to avoid SPAM, but not too difficult to work out the correct substitution.
From: Matt Fig on 5 Aug 2010 16:29 Why two posts? See your other thread on the same question.
|
Pages: 1 Prev: Why isn't [] considered empty? Next: global variable |