任意の値が配列の中にあるか検索したい
Afficher commentaires plus anciens
以下の2つの配列z1,z2があるとします。
z1=[18.0 17.3 16.6 ; 16.1 15.3 15.4];
z2=[14.3 15.7 16.0 ; 16.9 17.5 15.8];
この中から任意の値(仮に15.2とします)が存在するかを検索し、
①存在する場合には、どの配列の何行何列かを出力結果として出力、
②存在しない場合には、任意の値から最も近い値(誤差範囲 ±0.2)を出力し、その値はどの配列の何行何列かを出力結果として出力
する方法はありますでしょうか。
(②の例)
任意の値 15.2 が存在していないため、任意の値から最も近い値 15.4 (誤差範囲 ±0.2)を出力し、その値は z2 の2行3列に存在していることを出力結果として出力したい。
1 commentaire
Y.T
le 16 Déc 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!