Le 13/07/2015 23:53, Rafael Guera a écrit :

Samuel,

Thanks for the detailed explanation.

Not sure of what M(i) should mean in a situation where the matrices have different sizes:

data1=ones(10,4);

data2=zeros(5,3);

M=mlist(['V','field1','field2']);

M.field1=data1;

M.field2=data2;

or when the mlist fields are N-dimensional with different dimensions and/or sizes.

PS:

why not defining M(i) = M.field#i ?

Do you mean the ith field?
Why not. But mlists are designed to be array-oriented, as cells and structures are:
From help mlist:
" mlist object is very similar to tlist object. The only difference concerns the extraction and insertion syntax: if M is an mlist, for any index i which is not a field name, M(i) is no more the
 i-th field of the list."

If you wish (i) selecting a field, how will you select a component of the M array?

I mean, using i to select a field puts two way for the same purpose (selecting a field, either by its name, or by its index), and removes a way to select a component from the array.


What you wish looks like a simple tlist, with index just shifted by one to ignore the identification vector:
-->t = tlist(["test" "r" "b" "p"], %pi, %f, %z)
 t  =
       t(1)
!test  r  b  p  !
       t(2)
    3.1415927
       t(3)
  F
       t(4)
    z

-->t(3)
 ans  =
  F

-->t.b
 ans  =
  F

Samuel

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to