|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #32863] x.y.z syntax for structure fails ("scalar cannot be indexed with .") |
Date: | Thu, 24 Mar 2011 00:21:54 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15 |
Update of bug #32863 (project octave): Status: Need Info => Invalid Open/Closed: Open => Closed _______________________________________________________ Follow-up Comment #6: If you're goal was to mimic a hash-like structure you can arrange to do that by careful ordering of assignments. See below. tmp_struct.a = 1; tmp_struct.b = 2; x.label1 = tmp_struct; tmp_struct.a = 3; tmp_struct.b = 4; x.label2 = tmp_struct; x x = scalar structure containing the fields: label1 = scalar structure containing the fields: a = 1 b = 2 label2 = scalar structure containing the fields: a = 3 b = 4 Also, you might want to be aware of the () notation which allows you to use variables in place of explicit labels. For example, label = 'hello'; a.(label) = 'world'; a = scalar structure containing the fields: hello = world _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?32863> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |