[Scilab-users] How do I access structure elements in called function?
Sridhar Reddy
sridharreddyyedla at gmail.com
Mon May 30 08:22:27 CEST 2016
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?
%Scilab consoleS=struct('day',30,'month','may');fun(S);%called
functionfunction 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
requiredIs there any way to do this?thanks in advance =)
--
View this message in context: http://mailinglists.scilab.org/How-do-I-access-structure-elements-in-called-function-tp4034130.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160529/6e3fe4b3/attachment.htm>
More information about the users
mailing list