相关疑难解决方法(0)

julia在矩阵中找到(row,col)而不是index

在Julia中,您可以通过以下方式找到矩阵中元素的坐标:

julia> find( x -> x == 2, [ 1 2 3; 2 3 4; 1 0 2] )
3-element Array{Int64,1}:
 2
 4
 9
Run Code Online (Sandbox Code Playgroud)

这些值是正确的但我宁愿我得到(row,col)元组.

(1,2)
(2,1)
(3,3) 
Run Code Online (Sandbox Code Playgroud)

在朱莉娅实现这一目标的最简单方法是什么?

matrix find julia

5
推荐指数
1
解决办法
3385
查看次数

标签 统计

find ×1

julia ×1

matrix ×1