指定した列にある値の​範囲の行を元のテーブ​ルか抽出して、新しい​テーブルを作りたい

14 vues (au cours des 30 derniers jours)
DAIKI
DAIKI le 24 Mar 2023
Commenté : DAIKI le 24 Mar 2023
一つのテーブルの中に、Var1、Var2、・・・といろいろなデータがあるのですが、
その中で、指定した列(例えば5列目)に入力されている値に対して、指定した範囲(例えば2~6の範囲)の値が入力されている行だけを、抜き取って新しいテーブルを作ることは出来ますでしょうか?
  1 commentaire
DAIKI
DAIKI le 24 Mar 2023
早急のご回答ありがとうございました!

Connectez-vous pour commenter.

Réponse acceptée

Hernia Baby
Hernia Baby le 24 Mar 2023
Modifié(e) : Hernia Baby le 24 Mar 2023
indexに条件の合うものを格納すれば可能です
A = array2table(randi([0 10],8))
A = 8×8 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 ____ ____ ____ ____ ____ ____ ____ ____ 5 9 5 2 9 9 5 3 9 4 2 1 3 10 10 3 8 6 4 10 7 10 7 9 0 2 6 5 3 8 7 2 4 6 1 8 4 6 3 1 9 3 1 6 1 0 7 4 8 2 1 6 6 6 2 10 0 7 6 3 3 4 2 9
idx = A.Var6 < 8 & A.Var6 >2
idx = 8×1 logical array
0 0 0 0 1 0 1 1
B = A(idx,:)
B = 3×8 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 ____ ____ ____ ____ ____ ____ ____ ____ 4 6 1 8 4 6 3 1 8 2 1 6 6 6 2 10 0 7 6 3 3 4 2 9

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!