Pythonのnp.whereと同じ動作をつくりたい
Ältere Kommentare anzeigen
Pythonのライブラリにnumpyがあります。
import numpy as np
同サイズの行列(二次元の配列)で中身の異なるA,B,Cがあるとき、配列要素ごとの比較を行い、等しい時1、等しくなかったら0をCの各要素に入力したい。
C = np.where( A==B,1,0 );
上記のように書くと、Cに1と0が入った行列ができます。これをMATLABで作るにはどのような方法があるのでしょうか。
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB の Python ライブラリ finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!