Message Boards Message Boards

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

Where do I put the Join[] in this expression?

Posted 5 years ago

Hey! So maybe I'm just not seeing something, but where would it put a Join[] in the following expression to get just one list and not a list of lists?

In[]:= Table[Table[N[frequencyPitch[o, p]], {p, 1, intervalFundamentalPartition}], {o, 0, 1}]

Out[]= {{16.3516, 17.3239, 18.354, 19.4454, 20.6017, 21.8268, 
  23.1247, 24.4997, 25.9565, 27.5, 29.1352, 30.8677}, {32.7032, 
  34.6478, 36.7081, 38.8909, 41.2034, 43.6535, 46.2493, 48.9994, 
  51.9131, 55., 58.2705, 61.7354}}

If I use Catenate[] around the above expression it works; but I read somewhere I should use Join[] if working with pure lists.

Thank you very much!

Tim

POSTED BY: Timo Kuchheuser
2 Replies

Hi Tim,

the function you are asking for is Flatten:

llist = {{16.3516, 17.3239, 18.354, 19.4454, 20.6017, 21.8268, 
    23.1247, 24.4997, 25.9565, 27.5, 29.1352, 30.8677}, {32.7032, 
    34.6478, 36.7081, 38.8909, 41.2034, 43.6535, 46.2493, 48.9994, 
    51.9131, 55., 58.2705, 61.7354}};
Flatten[llist]

But in this case you could use Join like so:

Join @@ llist

Regards -- Henrik

POSTED BY: Henrik Schachner

That worked! Thank you very much! Danke!

POSTED BY: Timo Kuchheuser
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