I have a structure with two fields and I am passing this structure to a function. How to access elements of this structure in the called function?
<pre>
%Scilab console
S=struct('day',30,'month','may');
fun(S);
%called function
function fun(element)
fields=fieldnames(element);
disp(element.fields(1));
disp(element.fields(2));
endfunction;
</pre>
I tried bit differently,like
<pre>
disp(element.<b>(</b>fields(1)<b>)</b>);
disp(element.<b>(</b>fields(2)<b>)</b>);
</pre>
and changed '()' to '{}' and '[]',but none of them given me the output I required
Is there any way to do this?
thanks in advance =)
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mailinglists.scilab.org/How-do-I-access-structure-elements-in-called-function-tp4034130.html">How do I access structure elements in called function?</a><br/>
Sent from the <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab users - Mailing Lists Archives mailing list archive</a> at Nabble.com.<br/>