Hello Rafael,
Le 13/07/2015 22:18, Rafael Guera a écrit :
.../...
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)
.
M being a M-list, M(3) should extract the third component of M table(s),
so data1(3) and data2(3).
But you have to specify how you wish to display it:
* like [data1(3) data2(3) ] ?
* like [data1(3) ; data2(3) ] ? Then beware that the format of
M(3:4)... must be managed.
* like list(data1(3), data2(3)) ? Then what would return M(3:4)?
* like a struct s.data1 = data1(3) ; s.data2 = data2(3) ?
etc.
The same questions must be answered for insertion and extraction:
M(3) = [ %pi %e] // should distribute and assign %pi data1(3) and %e to
data2(3)
When you insert content, you must check that .data1 and .data2 keep the
same size..
M(3:5) could return either a structure array, or a cell array, or a
matrix... The developper must choose according to the purpose that is
followed...
HTH
Samuel
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users