Is there a “queue” in MATLAB?

后端 未结 7 1972
温柔的废话
温柔的废话 2020-12-28 16:14

I want to convert a recursive function to a iterative one. What I normally do is, I initialize a queue, put the first job into queue. Then in a while loop I consume

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 16:29

    If you insist on using proper data structures, you can use Java from inside MATLAB:

    import java.util.LinkedList
    q = LinkedList();
    q.add('item1');
    q.add(2);
    q.add([3 3 3]);
    item = q.remove();
    q.add('item4');
    

提交回复
热议问题