structure array: Support creation of new fields. Patch attached
Reported by Samuel GOUGEON (@sgougeon)
Originally assigned to Calixte DENIZET
-- Bug description --
structure array: Support creation of new fields.
After the initialization of a structure array with N fields declared, it is no longer possible to add new fields to the structure.
-- Scilab error message --
-->clear S
-->S(1:6).a="abc"
S =
6x1 struct array with fields:
a
-->S(1:6).b=%pi
!--error 1
Affectation incorrecte.
at line 6 of function generic_i_st called by :
at line 38 of function %s_i_st called by :
S(1:6).b=%pi
-->S(5) // S ok | altered ?
ans =
a: "abc"
-->S(:).b=%pi
!--error 1
Affectation incorrecte.
at line 6 of function generic_i_st called by :
at line 38 of function %s_i_st called by :
S(:).b=%pi
-->S // ok | altered ?
S =
6x1 struct array with fields:
a
-->S.b=%pi
!--error 1
Affectation incorrecte.
at line 6 of function generic_i_st called by :
at line 38 of function %s_i_st called by :
S.b=%pi
-->S // ok | altered ?
S =
6x1 struct array with fields:
a
-->S.b=S // but surprisingly...
S =
6x1 struct array with fields:
a
b
// Did it really work ??
-->S(1)
ans =
a: "abc"
b: [6x1 struct] // has taken the whole RHS food
-->S(2)
!--error 21
Index invalide.
at line 90 of function %st_e called by :
S(2)
// The price for adding "b" filed is quite high :-/
-- How to reproduce the bug --
clear S
S(1:6).a="abc"
S(1:6).b=%pi
S(5) // S ok | altered ?
S(:).b=%pi
S // ok | altered ?
S.b=%pi
S // ok | altered ?
S.b=S // but surprisingly...
S(1)
S(2)