フィルターのクリア

I want to change matrix value

2 ビュー (過去 30 日間)
Abdullah
Abdullah 2017 年 3 月 3 日
コメント済み: Adam 2017 年 3 月 8 日
I have image in V channel, I want to do like that IF the matirx element == this value then ignore else change the value of that pixel or number to this number then store it in new matrix How can I do that ?

回答 (2 件)

KSSV
KSSV 2017 年 3 月 3 日
K = round(rand(3,3)) ;
K0 = K
% change equal to one's to -1
K(K==1) = -1
  2 件のコメント
Abdullah
Abdullah 2017 年 3 月 8 日
thanks for your reply but my issue is like that I have image matrix example
A = 1 2 3 4 5 6 7 8 9 1 3 5 B = 1:3 if A==B change the value of that pixel to 0 else just leave it save the new A in A_new
that what i need to do
KSSV
KSSV 2017 年 3 月 8 日
To check for A==B both of them should be of same dimension. In your example, they are different.

サインインしてコメントする。


Adam
Adam 2017 年 3 月 3 日
編集済み: Adam 2017 年 3 月 3 日
myArray( myArray ~= someValue ) = someOtherValue;
  2 件のコメント
Abdullah
Abdullah 2017 年 3 月 8 日
thanks for your reply but my issue is like that I have image matrix example
A = 1 2 3 4 5 6 7 8 9 1 3 5 B = 1:3 if A==B change the value of that pixel to 0 else just leave it save the new A in A_new
that what I need to do
Adam
Adam 2017 年 3 月 8 日
A( ismember( A, B ) ) = 0;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by