Path: news.mathworks.com!not-for-mail
From: "Ashwath Sundaresan" <asu33@student.canterbury.ac.nz>
Newsgroups: comp.soft-sys.matlab
Subject: Dynamic Fields
Date: Tue, 4 Mar 2008 03:18:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fqif1a$dbo$1@fred.mathworks.com>
Reply-To: "Ashwath Sundaresan" <asu33@student.canterbury.ac.nz>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1204600682 13688 172.30.248.35 (4 Mar 2008 03:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Mar 2008 03:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1302244
Xref: news.mathworks.com comp.soft-sys.matlab:455158


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