Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MATLAB 行列で 4 より大きい値を持ついくつかの数値を選択し、それらをゼロに設定したいと思います。
例えば:
A=[5 6 1 3 4 9 2 8 3];
ここで、4 より大きいすべての値をゼロに置き換え、新しい行列 A1 として保存します。
A1=[0 0 1 3 4 0 2 0 3];
次のようなことを試してみてください。
A(A>4)=0
ここにあります:
>> A=[5 6 1 3 4 9 2 8 3] A = 5 6 1 3 4 9 2 8 3 >> A(A>4)=0 A = 0 0 1 3 4 0 2 0 3