[Scilab-users] How to use a string variable as a childname in a structure?

christophk christoph.knappe at gmail.com
Thu Dec 1 18:25:54 CET 2016


Hi there,

is there a way to use a string variable during a children-call in a scilab
structure?
Here is an example for what i want to do:

function myvalue = getchild(myparent,mychild)
    //this function doesn't work and is just meant to show the idea of what
I want to do:
   //"mychild" is a string to call for a childname of "myparent", which is a
struct. Is this at all possible?
    myvalue = myparent.mychild;    
endfunction

s = struct('a',[1 2 3],'b', [4 5 6]);
//how do I change my getchlidren function for this to work
x = getchild(s,'a'); // equivalent for x = s.a;
y = getchild(s,'b'); // equivalent for y = s.b;

Thanks all!



--
View this message in context: http://mailinglists.scilab.org/How-to-use-a-string-variable-as-a-childname-in-a-structure-tp4035161.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list