vendredi 30 juin 2017

compare values in a field of a structure and replace with values from another column

I have a structure E.ev (1x4658) with 41 fields. When in E.ev.field1 there are the strings 'A_check' or 'A_bring', then I need to replace 'A_check' and 'A_bring' with the corresponding values (in the sense the values of the same row) of the field E.ev.field39.

If in the E.ev.field1 there are other strings, but not the ones I am interested in, then I need to keep those strings of E.ev.field1.

E.ev.field1 is made of all strings. E.ev.field39 is made of strings and empty values.

I tried with:

ii={E.ev}
if strcmp(ii.field1,'A_check'|'A_bring')
ii.field1 = ii.field39
else
ii.field1 = ii.field1
end

but it doesn't work. It says: 'Attempt to reference field of non-structure array.

Aucun commentaire:

Enregistrer un commentaire