如何通过Julia的引用从Julia中的数组中弹出对象 [英] How to pop Object from array in Julia, by his refrences

查看:45
本文介绍了如何通过Julia的引用从Julia中的数组中弹出对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从数组中删除特定对象

I'm trying to delete a specific object from the array

我有一个由我定义的Objects Family数组

I have an array with Objects Family, defined by me

A =[Family(), ....]

我实现函数minimum,以便我可以传递数组A并获取对象

I implement function minimum so that i can pass array A and get a Object

family = minimal(A)

然后我接下来要从数组A

and i next want to delete this object from array A

pop!(A , family)

我收到了error pop! has no method matching pop!...

我正在搜索正确的弹出方法版本,但什么也没找到,我可以使用什么,对如何修复此代码有任何想法?

I search for correct pop method version but i find nothing, what i can use, any idea how to repair this code?

推荐答案

pop!应该弹出最近推送的对象.实际上,deleteat!是您要寻找的:

pop! is supposed to pop out the most recently pushed object. In fact, deleteat! is what you were looking for:

deleteat!(A, index)

我想,您可以直接从函数minimal获取索引.

you can get the index directly from the function minimal, i guess.

这篇关于如何通过Julia的引用从Julia中的数组中弹出对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆