Help with removing arrays from structure array?
古いコメントを表示
Hello. I have 1x50 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) =[];
end
end
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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Types についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!