[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cell arrays as dynamic field names of structures
From: |
Markus Appel |
Subject: |
cell arrays as dynamic field names of structures |
Date: |
Thu, 19 Dec 2013 15:02:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
Hi,
I found some of my scripts broken in the development version because I
(inadvertently) used a cell array containing only one string element as
dynamic field name for a structure:
In recent dev:
octave:1> S=struct('f',1);
octave:2> S.({'f'})
error: dynamic structure field names must be character strings
In 3.6.4:
octave:1> S=struct('f',1);
octave:2> S.({'f'})
ans = 1
Playing around some more I found that there seems to be some kind of bug
in 3.6.4:
octave:8> S=struct('f',1);
octave:9> S.({'f'})
ans = 1
octave:10> S.({'f' 'g'})
ans = 1
octave:11> S.({'f' 'gg'})
error: structure has no member 'f'
octave:11> S.({'f' '%'})
ans = 1
I wanted to write a regression bug report, but now I have the feeling
that this was a bug fix. I guess that even one-element cell arrays have
never been supposed to be used as dynamic field names in the first place?
Cheers,
Markus
- cell arrays as dynamic field names of structures,
Markus Appel <=