Matlab - Stack Data Structure

后端 未结 5 1984
悲哀的现实
悲哀的现实 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

    You can roll your own or you can use someone else's, like this.

    A very simple homemade stack would be an array with a count, the count pointing to the topmost item.

提交回复
热议问题