I have a structure with two fields and I am passing this structure to a function in scilab. How to access elements of this structure in the called function?
%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;
I tried bit differently,like
disp(element.(fields(1)));
disp(element.(fields(2)));
and changed '()' to '{}' and '[]',but none of them given me the output I required
Is there any way to do this?
thanks in advance =)