Pythonのnp.whereと同じ動作をつくりたい
Mostrar comentarios más antiguos
Pythonのライブラリにnumpyがあります。
import numpy as np
同サイズの行列(二次元の配列)で中身の異なるA,B,Cがあるとき、配列要素ごとの比較を行い、等しい時1、等しくなかったら0をCの各要素に入力したい。
C = np.where( A==B,1,0 );
上記のように書くと、Cに1と0が入った行列ができます。これをMATLABで作るにはどのような方法があるのでしょうか。
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB の Python ライブラリ en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!