Path: news.mathworks.com!not-for-mail
From: "Kirk" <kwythers.nospam@umn.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how can one index into a cell array of structs?
Date: Fri, 10 Aug 2012 13:26:08 +0000 (UTC)
Organization: University of Minnesota
Lines: 24
Message-ID: <k0325g$rh2$1@newscl01ah.mathworks.com>
References: <k0319f$okg$1@newscl01ah.mathworks.com>
Reply-To: "Kirk" <kwythers.nospam@umn.edu>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1344605168 28194 172.30.248.45 (10 Aug 2012 13:26:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 10 Aug 2012 13:26:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1161409
Xref: news.mathworks.com comp.soft-sys.matlab:776151

"Kirk" <kwythers.nospam@umn.edu> wrote in message <k0319f$okg$1@newscl01ah.mathworks.com>...
> I am trying to produce a map of climate values that are stored in a cell array of structures. For example, from the cell array {}Clim<79x133>, I can retrieve all of a single cell's maximum temperatures (which is a 13680x1 double) with:
> 
> Clim{1,1}.tmax
> 
> This command gives me all 13680 maximum temperature values from the element tmax. I need to grab a single value for that element for all cells in the array (let's say the last value, number 13680 from all cells)...
> 
> I have tried things like 
> 
> Clim{:,:}.tmax(1360,:)
> 
> to no avail...
> 
> Can anyone suggest an approach? 
> 
> Thanks in advance


God am I dense... It seems that I asked this very question 6 months ago. MattJ kindly provided a solution:

tmax_1 = arrayfun(@(i) ClimIn{i}.tmax(1), 1:numel(ClimIn)); 
tmax_1 = reshape(tmax_1, size(ClimIn));

Works well. Sorry