Using Java PriorityQueue in Matlab -


I need a minute-stack in Matlab and I'm trying to use the PriorityQueue of Java. How can I make comparative supplies So far, I have started PriorityQueue and can add a price index pair to it:

  & gt; & Gt; Q = java.util.PriorityQueue q = []> & Gt; The problem occurs when I try to add more data:  
  & gt; & Gt; Q.add ({2,4}) ??? Java exception occurred: java.lang.ClassCastException: [Ljava.lang.Object; Java.util.PriorityQueue.offer on java.util.PriorityQueue.siftUp on java.util.PriorityQueue.siftUpComparable (unknown source) (unknown source) can not be molded in java.lang.Comparable is. PriorityQueue.add (unknown source)   

By post, I think I need to supply a comparative function, but I do not know the ways to do this.

In need to pass in a comparative function.

Currently there is no way in MATLAB to implement Java interface with MATLAB code or to provide literal Java code.

So you have to follow the suggestion of @Neibot and have to do a little. The file that contains the class implementation is comparative.

Comments