[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
struct weirdness
From: |
Przemek Klosowski |
Subject: |
struct weirdness |
Date: |
Thu, 23 Aug 2012 10:46:18 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
I was looking at the example from http://wiki.octave.org/Cookbook:
samples = struct ("patient", {"Bob", "Kevin", "Bob" , "Andrew"},
"age", [ 45 , 52 , 45 , 23 ],
"protein", {"H2B", "CDK2" , "CDK2", "Tip60" },
"tube" , [ 3 , 5 , 2 , 18 ]
);
in Octave 3.6.2. I see that samples.patient returns the sequence of
names, as I'd expect (ans = 'Bob, ans = Kevin, etc). However,
samples.age returns the 'age' array four times. Also, samples(1)
returns
scalar structure containing the fields:
patient = Bob
age = 45 52 45 23
protein = H2B
tube = 3 5 2 18
rather than what I was hoping for (Bob, 45, H2B, 3).
This cookbook recipe looked like a neat idea for keeping track of
complex data but is there a better way using struct() for this purpose?
or is a newer version of Octave required?
- struct weirdness,
Przemek Klosowski <=
- Re: struct weirdness, Sergei Steshenko, 2012/08/23
- Re: struct weirdness, Jordi Gutiérrez Hermoso, 2012/08/23
- Re: struct weirdness, Jordi Gutiérrez Hermoso, 2012/08/23
- Re: struct weirdness, John W. Eaton, 2012/08/23
- Re: struct weirdness, Sergei Steshenko, 2012/08/24
- Re: struct weirdness, Ben Abbott, 2012/08/24