Find position of the maximum value and then convert the row zeros and the position of the maximum value should become 1. just like in the image attach

1 回表示 (過去 30 日間)

採用された回答

KSSV
KSSV 2021 年 11 月 23 日
A = rand(4) ;
[m,n] = size(A) ;
B = zeros(m,n) ;
[val,i] = max(A,[],2) ;
idx = sub2ind(size(A),(1:m)',i) ;
B(idx) = 1 ;
  1 件のコメント
Adil Sardar
Adil Sardar 2021 年 11 月 24 日
Thank you..
This output is from simulink I saved it in a file.. Instead of saving it how to apply this method in simulink for running time so that I get the output in binary format.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by