Hello. I have 1×50 structure array called 'data2' with 18 fields. I am trying to remove arrays that have zero matrices in their fields. Example is data2(1) as shown below.
data2(1)ans= type: 'A321' time: [0x1 double] lat: [0x1 double] lng: [0x1 double] altitude: [0x1 double] selected_altititude: [0x1 double] BPS: [0x1 double] RA: [0x1 double] TTA: [0x1 double] GS: [0x1 double] TAR: [0x1 double] TAS: [0x1 double] heading: [0x1 double] IAS: [0x1 double] Mach: [0x1 double] BAR: [0x1 double] IVV: [0x1 double] wind: [0x1 double]
I am using the following code to try to remove the arrays.
for n = 1 : length(data2) if isempty(data2(n).TTA) data2(n) =[]; endend
Can anyone explain me what is wrong? (I am using the field TTA solely because of my preference. I can use any of them, since all of them are either zeros, or have values.) Thanks.
Best Answer