如何在朱莉娅的矩阵中删除列?
如果我有一个矩阵m
,以便m = [0 1 2; 3 4 5; 6 7 8]
,如何删除指定的列。例如,在删除第二列后,m
将为[0 2; 3 5; 6 8]
。
在numpy
中,存在一个numpy.delete
函数,可以执行我的要求(沿特定轴删除),但是我不确定朱莉娅等效的是什么。
If I had a matrix M
such that M = [0 1 2; 3 4 5; 6 7 8]
, how could I delete a specified column. For example, after I deleted the second column M
would be [0 2; 3 5; 6 8]
.
In numpy
, there exists a numpy.delete
function that does what I ask (deleting along a specific axis), but I am unsure as to what the Julia equivalent is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过数组索引直接执行此操作,
请注意,
≠
是\ neq
+ TAB 。或使用
You can do it directly with array indexing,
note that
≠
is written as\neq
+ Tab from keyboard.Or using packages like InvertedIndices.jl: