Message Boards Message Boards

0
|
4352 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

The variable that contains an entire number in the end,

Posted 10 years ago

If I have the following variables:

   gpo={};
    oee={{{0, 50}, {120, 100}}, 2};
    If[ gpo= ={} && Last[oee] ==(* any integer *)
    ,
    (* then that returns me the variable that contains an entire number in the end, in this case oee *)
    ]

I have tried using Cases without success, any idea is useful and welcome,

I would like to ask if I can clear some threads that I've started ?

POSTED BY: Luis Ledesma
2 Replies

Bruce - I'm not entirely certain, but I think an "entire number" is an integer.

Luis - I don't quite understand what exactly you want your code to return; do you want the name of the variable? Are there more variables than just "oee", and you need to find the one that ends with that specific integer? I don't think you can easily access the name of a variable once it's been assigned a value, so you might have to write this differently.

Does something like this help you at all?

gpo = {};
foo["a"] = {{{0, 50}, {120, 100}}, 2};
foo["b"] = {{{10, 30}, {110, 90}}, 4};
foo["c"] = {{{20, 40}, {80, 30}}, 7};
foo["d"] = {{{20, 50}, {70, 30}}, 2};
names = {"a", "b", "c", "d"};
DeleteCases[If[gpo == {} && Last[foo[#]] == 2, #] & /@ names, Null]
(*the ouput of this is: {"a", "d"}*)
POSTED BY: Bianca Eifert

a) What is an "entire number"?

b) If there are posts of yours you would like deleted, email wolfram-community@wolfram.com and describe which new thread or reply you want deleted. The URL (example: http://community.wolfram.com/groups/-/m/t/326537) is helpful.

POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract