From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Breaking Up Large Cell Array into Smaller Cell Arrays
Date: Tue, 21 Aug 2012 22:15:20 +0000 (UTC)
Organization: University of Colorado Denver
Lines: 16
Message-ID: <k1119o$d34$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1345587320 13412 (21 Aug 2012 22:15:20 GMT)
NNTP-Posting-Date: Tue, 21 Aug 2012 22:15:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2492023
Xref: comp.soft-sys.matlab:776919


I have a unique problem. Right now I have a large cell array and I want to break that cell array into smaller cell arrays. Here is a portion of the large cell array:

C = 

              [1x35 char]    [1x39 char]    'ALAMEDA'      'CA'
              [1x30 char]    [1x20 char]    'ALAMEDA'       'CA'
              [1x30 char]    [1x20 char]    'LUDINGTON'    'MI'
              [1x30 char]    [1x20 char]    'LUDINGTON'    'MI'

Now, for this test case I want to break this into two smaller cell arrays according to the value in the third column. Here is where it gets difficult for me. I want to take the value 'ALAMEDA', make that a cell array, and fill it with all the entries that have 'ALAMEDA' in the third column. The problem I am facing is that I have to dynamically change variables names to value from the larger cell array C. The reason being is that the original cell array is 89492x17 cells, so I need to automate the process by having the program look for the change (in this case between 'ALAMEDA' and 'LUDINGTON') between variables and know to create a new variable name and fill the cell array.

I have tried to use eval, but that was unsuccessful. For me, this is pretty difficult and I would appreciate any help or guidance. My problem is unique, but I hope I explained it well enough here. Thanks.