[Scilab-users] How to assign column data to mlist?
Samuel Gougeon
sgougeon at free.fr
Sat Jul 11 20:17:48 CEST 2015
Hello,
Le 11/07/2015 13:41, jaipur a écrit :
> When I already have column data, how shall I collect these data into a mlist?
>
> For example, I have 2 column data,
> data1=[11:20]'; data2=[21:30]';
> I create a mlist,
> MyMlist = mlist(['M', 'field1', 'field2', 'field3']);
> I'd like to assign data1, data2 to field1, field2, and access them as
> MyMlist(3).field1 and so on.
.
What do you expect from MyMlist(3).field1 ? and from MyMlist.field1 ?
and from MyMlist.field1(3)?
Extractions must be defined for the M type.
> And size(MyMlist) or length(MyMlist) should be
> 10.
>
> I tried
> MyMlist.field1= data1; MyMlist.field2= data2;
> The result is
> size(MyMlist) does not work.
.
This is normal: when a new typed list is defined, all operations for it
must be explicitely defined: here, %M_size() for size(), extraction,
insertion, etc
> length(MyMlist) is 3.
define %M_length()
> And
> MyMlist(1) indicate !M field1 field2 field3 !
> MyMlist(2) indicate the values of data1
> MyMlist(3) indicate the values of data2
Really? For these extractions, i get an error (for each).
HTH
Samuel
More information about the users
mailing list