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 CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by