How to sort instances by property value

Discussion in 'Cadence' started by Edis, Sep 18, 2009.

  1. Edis

    Edis Guest

    Hi GURUs
    I have long list (>5000) of instances, e.g. pcapacitors. I want to
    sort this list by capacitor value, e.g. pc~>c.
    Are any ready or built-in functions to do that.
    Thanks
     
    Edis, Sep 18, 2009
    #1
  2. Edis wrote, on 09/18/09 15:45:
    sorted=sort(instances lambda((a b) a~>c < b~>c))

    or if the C value is a string, you would probably best to do:

    sorted=sort(instances lambda((a b) cdfParseFloatString(a~>c) <
    cdfParseFloatString(b~>c)))

    Or you could define your own comparison function and just pass that to the
    second argument to the sort function.

    Best Regards,

    Andrew.
     
    Andrew Beckett, Sep 18, 2009
    #2
  3. Edis

    Edis Guest

    Thank you, Andrew
    It worked just fine.
     
    Edis, Sep 20, 2009
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.