Pythonのnp.whereと同じ動作をつくりたい
Show older comments
Pythonのライブラリにnumpyがあります。
import numpy as np
同サイズの行列(二次元の配列)で中身の異なるA,B,Cがあるとき、配列要素ごとの比較を行い、等しい時1、等しくなかったら0をCの各要素に入力したい。
C = np.where( A==B,1,0 );
上記のように書くと、Cに1と0が入った行列ができます。これをMATLABで作るにはどのような方法があるのでしょうか。
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB の Python ライブラリ in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!