Group Abstract Group Abstract

Message Boards Message Boards

Select a cable name with a dynamic popupmenu and Position?

Posted 7 years ago
POSTED BY: Gerald Proteau
2 Replies
Posted 7 years ago

Try wrapping the whole query in Dynamic:

Dynamic[Position[cablearray, u]]
POSTED BY: Kyle Martin
Posted 7 years ago

This work very nicely and gives the cable name in quotes. Thanks. I'm still quite new to Mathematica.

That said, I'm not sure how to clear the error: Part::pkspec1: The expression ?? cannot be used as a part specification. Generated by code below. I've reviewed the many other replies to this simple question, but remain stumped.

sccdata = {{"ACCR_558-T73", 0.`, 31378.`, -17629.9`, -6893.`, 
    3574.`}, {"Bison", -472.6`, 52971.8`, -51954.7`, 13720.`, 
    6138.`}, {"Bittern", -1012.4`, 64046.`, -50768.6`, -27693.`, 
    39210.`}, {"Bluebird", -1237.2`, 64355.7`, -63104.2`, 5109.`, 
    15764.`}, {"Bluejay", -1012.4`, 64046.`, -50768.6`, -27693.`, 
    39210.`}, {"Bluejay_t2", -1012.4`, 64046.`, -50768.6`, -27693.`, 
    39210.`}, {"Bobolink", -1012.4`, 64046.`, -50768.6`, -27693.`, 
    39210.`}, {"Brant", -1653.6`, 71375.3`, -82065.9`, 20811.`, 
    13436.`}, {"Bunting", -1012.4`, 64046.`, -50768.6`, -27693.`, 
    39210.`}, {"Canary", -472.6`, 52971.8`, -51954.7`, 13720.`, 
    6138.`}}  cablearray = {"Bison", "Bittern", "Bluebird", "Bluejay", "Bluejay_t2",
        "Bobolink", "Brant", "Bunting", "Canary", "Canvasback", 
       "Cardinal", "Chickadee", "Chukar", "Cochin", "Condor", "Coot", 
       "Curlew", "Dipper", "Dorking", "Dotterel", "Dove", "Drake", 
       "Eagle", "Egret", "Falcon", "Finch", "Flamingo", "Flicker", 
       "Gannet", "Grackle", "Grosbeak", "Grouse", "Guinea", "Hawk", "Hen",
        "Ibis", "Kingbird", "Lark", "Leghorn", "Mallard", "Martin", 
       "Merlin", "Minorca", "Orchid AAC", "Oriole", "Ortolan", "Osprey", 
       "Ostrich", "Parakeet", "Partridge", "Peacock", "Pelican", 
       "Penguin", "Petrel", "Pheasant", "Pigeon", "Quail", "Rail", 
       "Raven", "Redwing", "Robin", "Rook", "Ruddy", "Sparate", "Sparrow",
        "Squab", "Starling", "Stilt", "Swan", "Swanate", "Swift", "Teal", 
       "Tern", "Turkey", "Waxwing"};
    (*Make pop up menu to select conductor*)
    cables = {PopupMenu[Dynamic[u], cablearray], Dynamic[u]}
    (*Get row number for conductor, clear out brackets*)
    cableloc = Dynamic[First[Flatten[Position[cablearray, u]]]]
    (*Define table for coefficients*)
    a = Table[0, {i, 1, 5}]
    i = 1;
    (*Attempt to fill table with cable coefficients*)
    Do[
      a[[i]] = sccdata[[cableloc, i + 1]];
      i = i + 1;
      , 5]; ;
POSTED BY: Gerald Proteau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard