Hello. I am trying to extract several Aircraft data from a general data I have. I want the following 6 aircraft data from my general structure data. If it were for only 1 aircraft type, it works fine. However, for several aircraft, it doesn't. I am using a method such that my field 'type' matches the aircraft types and extract those data. If I use & instead of |, it also doesn't work. ( I believe it suggests that both conditions must be satisfied if I use '&' which doesn't make sense since each array has only 1 type.)
idx_plane = false(length(data2),1);for p = 1 : length(data2) % 1574
if strcmp(data2(p).type, 'A319') | strcmp(data2(p).type, 'A318') | strcmp(data2(p).type, 'B788') | strcmp(data2(p).type, 'A320') | strcmp(data2(p).type, 'A321') | strcmp(data2(p).type, 'A330') idx_plane(p) = true; endenddata2 = data2(idx_plane);
Best Answer