Prev: rotation of checkboard
Next: rotate3d of a checkerboard
From: Nischal on 25 Mar 2010 17:27 I want to have an array value from a inputdlg to be added to my structure name.. For example, If my inputdlg creates following array based on my input to inputdlg A.. A = Name, employer, Salary Now, I want to create a structure based on A(1) = Name as follows.. Name.aaa.bbb.ccc = N(:,1); Name.ddd.eee.fff = N(:,2); ..... How can I do this? A(1) or A{1}.aaa.bbb.ccc = N(:,1) does not work. This creates structure A{1}.aaa.bbb.ccc structure as oppose to Name.aaa.bbb.ccc structure.. Nischal
From: nanren888 on 1 Apr 2010 17:28 "Nischal " <nischalamin(a)gmail.com> wrote in message <hogkf8$pka$1(a)fred.mathworks.com>... > I want to have an array value from a inputdlg to be added to my structure name.. > > For example, > > If my inputdlg creates following array based on my input to inputdlg A.. > > A = Name, > employer, > Salary > > Now, I want to create a structure based on A(1) = Name as follows.. > > Name.aaa.bbb.ccc = N(:,1); > Name.ddd.eee.fff = N(:,2); > .... > > How can I do this? > > A(1) or A{1}.aaa.bbb.ccc = N(:,1) does not work. This creates structure A{1}.aaa.bbb.ccc structure as oppose to Name.aaa.bbb.ccc structure.. > > Nischal > I think not much help, but a few comments; (1) This seems like a bad idea. (2) Eval can (& should not be allowed to) do anything. (3) This seems like a bad idea. You're letting the user created structures named as they please? * What if they coincide with ones you have? * Will you not then have an issue accessing them later: same problem with working out the name? * If the names are from the dialog you wrote, don't you know the names? * Yes, I realise that you might specify field names without wanting programme them in, but it still feels like a bad move, somehow. If they really are at the level of being field names of some structure, maybe do that info.(A{1}).blah.blah = such_&_such Just some thoughts.
|
Pages: 1 Prev: rotation of checkboard Next: rotate3d of a checkerboard |