[Scilab-users] Array of struct

sgougeon at free.fr sgougeon at free.fr
Fri Mar 1 12:46:13 CET 2013


>>amiege wrote:
>> I would prefer to have the whole of the struct temp to be pts($+1), so
>> that pts(i) contains all the information related to the data file that has
>> been parsed, so I think that's a). pts(i) would then be a struct which
>> would match what temp is or was when it was constructed.
>> 
>> I will try the various solutions suggested and report back which one works best.


>>amiege wrote:
>seems to work. 

Not as a). For this, since you do not need that pts has some fields,
a cell would be preferable (by the way, i did not know nor find any
way to do it with pts as a struct). This will give:

pts = cell()   // A cell instead of a 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);


pts(size(pts,"*")+1).entries = temp   // pts($+1).entries addressing fails
pts(size(pts,"*")+1).entries = temp
pts(2).entries


Samuel



More information about the users mailing list