Path: news.mathworks.com!not-for-mail
From: "per isakson" <poi.nospam@bimDOTkthDOT.se>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Dynamic Fields
Date: Tue, 4 Mar 2008 04:18:02 +0000 (UTC)
Organization: KTH
Lines: 31
Message-ID: <fqiihq$kj5$1@fred.mathworks.com>
References: <fqif1a$dbo$1@fred.mathworks.com>
Reply-To: "per isakson" <poi.nospam@bimDOTkthDOT.se>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1204604282 21093 172.30.248.38 (4 Mar 2008 04:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Mar 2008 04:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1670
Xref: news.mathworks.com comp.soft-sys.matlab:455162


"Ashwath Sundaresan" <asu33@student.canterbury.ac.nz> wrote 
in message <fqif1a$dbo$1@fred.mathworks.com>...
> Hi 
> 
> I currently have a 1x1 sturcture. The structure contains 
> 6001x3 array.
> 
> s=load('Patient1_PV_PEEP1.mat'
> J = fieldnames(s)
> n1=500;
> n2=35/0.01;
> t=s.(J)(n1:n2,1)
> P=s.v(n1:n2,2)
> V=s.v(n1:n2,3)
> 
> The code loads up the mat file. This may change depending 
> on the patient. Three variables in the array are time, 
> pressure and volume. The name of the field is 
> Patient1_PV_PEEP1 and this is variable depending on 
> patient. When I attempt to use dynamic field names, the 
> lines with t, P and V give me this message:
> 
> 'Argument to dynamic structure reference must evaluate to 
a 
> valid field name'
> 
> Cheers
> 

J is that a character string or a cell array (1x1) of 
strings? Should be the former / per