[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: another bug? with arrays of structures?
From: |
Reiner.Suikat |
Subject: |
AW: another bug? with arrays of structures? |
Date: |
Tue, 3 May 2005 03:40:12 -0500 |
Sorry for that, I must have mistyped something, it actually works.
But I just found out where my real problem comes from, its reloading an array
of structs from file:
Octave 2.1.50:
>> a(2).f=1
a =
{
f =
(
[1] = []
[2] = 1
)
}
>> save test a
>> clear all
>> load test
>> a
a =
{
f =
(
[1] = []
[2] = 1
)
}
>> a(2)
ans =
{
f = 1
}
>>
The same in Octave 2.1.69:
octave:44> a(2).f=1
a =
{
f =
(,
[1] = [](0x0)
[2] = 1
,)
}
octave:45> save test a
octave:46> clear all
octave:47> load test
octave:48> a
a =
{
f =
{
[1,1] = [](0x0)
[1,2] = 1
}
}
octave:49> a(2)
error: invalid vector index = 2
octave:49>
Obviously something gets changed when reloading the array of structs from file,
all the sudden a.f has two indices rather than just one. This also happens when
loading the file saved with 2.1.50 into 2.1.69.
Thanks for your help
Reiner
> -----Ursprüngliche Nachricht-----
> Von: John W. Eaton [mailto:address@hidden
> Gesendet: Dienstag, 3. Mai 2005 04:41
> An: Suikat, Reiner
> Cc: address@hidden
> Betreff: another bug? with arrays of structures?
>
> On 2-May-2005, address@hidden wrote:
>
> | Hi all,
> | after Johns patch got one error fixed, I am still having a problem.
> |
> | In 2.1.50, the following works:
> | a(1).b=4;
> | c=a(1);
> | a(1)=c;
> | (actually I am using this in a function call, like
> a(1)=f(...), with
> | a(1) being a struct.)
> |
> | In 2.1.69 I get the following:
> | a(1).b=4;
> | c=a(1); << same output as in 2.1.50
> | a(1)=c
> | octave:8> a(1)=b
> | error: field name mismatch in structure assignment
> | error: assignment to structure element failed
> | error: assignment failed, or no method for `struct = struct'
> | error: evaluating assignment expression near line 8, column 5
>
> What is the value of b in the assignment a(1)=b above?
>
> When assigning structures in this way, the RHS value must be
> a structure with the same fields as the structure referenced
> on the LHS of the assignment.
>
> jwe
>
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- AW: another bug? with arrays of structures?,
Reiner.Suikat <=