[Scilab-users] Array of struct

sgougeon at free.fr sgougeon at free.fr
Fri Mar 1 11:35:48 CET 2013


>//a : is actually needed, but here:
>pts($+1) = temp(:)

Sorry amiege, i have forgotten clearing pts before issuing this command,
and its result is not the expected one. By the way, what's the expected
result? Do you wish 
a) to add temp(1:$) as a whole, as a _single_ new element of pts(), or
b) to add each element temp(i) as a new corresponding element in pts($+i),
   in a "distributive" way?

In the latter case, the (whole) following does the job:

pts = struct();
temp(1).partnumber = 1;
temp(1).P = zeros(8,3);
temp(1).C = zeros(96,5);
temp(2).partnumber = 2;
temp(2).C = zeros(96,5);
temp(2).P = zeros(8,3);

s = size(pts,"*");
st = size(temp,"*");
pts(s+1:s+st) = temp(:) // pts($+1:$+st) can't be used


Samuel



More information about the users mailing list