配列の抽出

14 visualizzazioni (ultimi 30 giorni)
寛太 大崎
寛太 大崎 il 11 Lug 2022
Commentato: Hernia Baby il 11 Lug 2022
A 430000×5 table
Aがワークスペースにある変数です。
Aの二行目に含まれるNaN以外のデータを取り出し配列を整理した場合にはどうすれば良いでしょうか。
431520    0.1 130 33 145
431450    NaN 181 91 123
431050     0.1 131 33 299
431370    13 130 34 348
431080    13 33 33 236
438077    14   130   34  308 
431051    12   130   33    35
上記のNaNが含まれる列以外の行列データが欲しいのですが、わからないです。

Risposte (1)

Hernia Baby
Hernia Baby il 11 Lug 2022
Modificato: Hernia Baby il 11 Lug 2022
rmmissingが使えます。
A = [431520 0.1 130 33 145
431450 NaN 181 91 123
431050 0.1 131 33 299
431370 13 130 34 348
431080 13 33 33 236
438077 14 130 34 308
431051 12 130 33 35]
A = 7×5
1.0e+05 * 4.3152 0.0000 0.0013 0.0003 0.0014 4.3145 NaN 0.0018 0.0009 0.0012 4.3105 0.0000 0.0013 0.0003 0.0030 4.3137 0.0001 0.0013 0.0003 0.0035 4.3108 0.0001 0.0003 0.0003 0.0024 4.3808 0.0001 0.0013 0.0003 0.0031 4.3105 0.0001 0.0013 0.0003 0.0003
欠損値のある列を削除なのでdimを2にします
rmmissing(A,2)
ans = 7×4
431520 130 33 145 431450 181 91 123 431050 131 33 299 431370 130 34 348 431080 33 33 236 438077 130 34 308 431051 130 33 35
  1 Commento
Hernia Baby
Hernia Baby il 11 Lug 2022
補足:削除の方向は dim — 演算の対象の次元 でわかります。

Accedi per commentare.

Categorie

Scopri di più su Logical in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!