Pythonのnp.whereと同じ動作をつくりたい
Afficher commentaires plus anciens
Pythonのライブラリにnumpyがあります。
import numpy as np
同サイズの行列(二次元の配列)で中身の異なるA,B,Cがあるとき、配列要素ごとの比較を行い、等しい時1、等しくなかったら0をCの各要素に入力したい。
C = np.where( A==B,1,0 );
上記のように書くと、Cに1と0が入った行列ができます。これをMATLABで作るにはどのような方法があるのでしょうか。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB の Python ライブラリ 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!