[Scilab-users] Convert struct to mlist/tlist

sgougeon at free.fr sgougeon at free.fr
Wed Jul 12 19:15:16 CEST 2017


Hello Shamikan,

A (array of) structures IS a mlist. The list of defined fields is returned by fieldnames():

--> s.b = %t;
--> s.r = %pi;
--> s.p = %z
 s  = 
  b: [1x1 boolean]
  r: [1x1 constant]
  p: [1x1 polynomial]


--> fieldnames(s)
 ans  =
!b  !
!   !
!r  !
!   !
!p  !

And the number of fields:
--> size(fieldnames(s),1)
 ans  =
   3.

Regards
Samuel Gougeon



More information about the users mailing list