[Scilab-users] How to assign column data to mlist?

Rafael Guera jrafaelbguerra at hotmail.com
Mon Jul 13 22:18:29 CEST 2015


Hello,
 
I am trying to understand what Jaipur/Tachihara aims to achieve and wondering
why simple code such as shown below cannot meet his requirements:
 
data1=[11:20]';
data2=[21:30]'; 
M = mlist(['V', 'field1', 'field2']);
M.field1 = data1;
M.field2 = data2;
disp(M)
printf("\n\n");
M.field1(2) = %e; // individual element assignment
M.field2(3:6) = %pi; // sub-array assignment
printf("%10.3f  %10.3f\n", M.field1, M.field2);
 
Also could someone explain why command “M(3)” produces errors and overloading is
required? (using Scilab 5.5.2 in Win7)
 
Thanks and regards,
 
Rafael
 
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Samuel Gougeon
Sent: Sunday, July 12, 2015 9:50 AM
To: International users mailing list for Scilab.
Subject: Re: [Scilab-users] How to assign column data to mlist?
 
Le 12/07/2015 06:21, jaipur a écrit :
> Thanks for your suggestion.
> 
> Each element of data1 and data2 has, for example, individual's property like
> his height and weight. So, I want to treat as one element of mlist like
> MyMlist(3), MyMlist(3).field1, MyMlist(3).field2 when notice as individual.
> 
> On the other hand, when I want to calculate mean value etc. of property, I'd
> like to treat as MyMlist.field1, MyMlist.field2(3:6) and so on.
> 
> I understand overloading is the right way concerning mlist.
> But, is there simple way to create one structure without overloading
> fulfilling my wish above, when  I have each property data, data1 and data2?
You may use a structures array instead, together with list2vec(..) after 
extraction of values of any scalar field.
As well, do not hesitate to comment this thread 
 <http://bugzilla.scilab.org/11888> http://bugzilla.scilab.org/11888, that
claims for your request.
Presently, it is not possible to do element-wise assignment on 
structures array. Free overloadable operators
can't work with operands passed by reference, so can't be used for 
overloading some new types of assignment.
 
Regards
Samuel
 
_______________________________________________
users mailing list
 <mailto:users at lists.scilab.org> users at lists.scilab.org
 <http://lists.scilab.org/mailman/listinfo/users>
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150713/4f5fba73/attachment.htm>


More information about the users mailing list