matrix problem not getting desired result.
古いコメントを表示
A=[0 0 0 0 0;0 1 1 0 0;0 1 0 0 0;0 1 1 0 0]; [rows, cols] = find(A == 1); n1=min(cols); n2=max(cols); m1=min(rows); m2=max(rows); for i=n1:n2 count=0; for j=m1:m2 if A(j,i)==1 count=count+1; end end count1=count; end
RESULT: count1=2
REQUIRED RESULT: count1=[3 2]
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!