简单的MATLAB。
3 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
yfgersch
2023 年 5 月 25 日
A=[0,5,0,0,0,0;
0,0,5,5,5,0;
0,0,0,0,0,0;
0,0,0,0,0,0;
0,0,0,0,0,5];
for i=1:5%
for j=1:6%
if A(i,j)>0
M(j*i)=A(i,j);会遍历矩阵A所有元素
end
end
end
M(M==0)=[]
最简单的方式如下
A=[0,5,0,0,0,0;
0,0,5,5,5,0;
0,0,0,0,0,0;
0,0,0,0,0,0;
0,0,0,0,0,5];
M = A(A==5)'
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!