Matlab - Stack Data Structure

后端 未结 5 1909
悲哀的现实
悲哀的现实 2021-02-07 22:39

Can I have a stack data structure in matlab?

For example a stack of integers where I can push elements in it like stack.push(i), get elements out of it like

5条回答
  •  情话喂你
    2021-02-07 23:32

    I do not think MATLAB has one even in the newer versions. But you can use Java, it is a "first class citizen" in MATLAB, it would work perfectly with integers as you need it. See also queue and linked-list related questions.

    Just write in MATLAB stack=java.util.Stack() and then you can call methods on it as in your question stack.push(i), ecc.

提交回复
热议问题