Message Boards Message Boards

0
|
4694 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Importing XL sheet: removing extra brackets

Hello, When we import an XL file, it is of the form {{{1},{3},{1},{2},{3}}}. How to transform it into a standard Mathematica LIST like {1,3,1,2,3}, etc... ? I.e. remove the broken brackets form around every number... It is a very large list, and there is no point in doing it manually! Thanks

POSTED BY: Rabih Sultan
4 Replies
Posted 2 years ago

Try this.

Partition[Flatten[Import[...]],{2}]

Or

Flatten[Import[...],1]
POSTED BY: Paul Cleary

Hello, a follow-up inquiry please. When we import an XL data file, we get the following format: {{{0,2},{1,3},{2,5}}} I need to transform it to the format {{0,2},{1,3},{2,5}} to be able to apply Interpolation. 'Flatten' did not work here, as it removed all the brackets; thus the points are no longer pairs of x and y coordinates. Thanks R

POSTED BY: Rabih Sultan

Thank you very much. It certainly worked. Rabih

POSTED BY: Rabih Sultan
Posted 2 years ago

What you get is a list of sheets, then rows/cols for each sheet (hence the 3 dimensions). If your data is structured in a way where all you need is all of the numbers in one flat list, perhaps Flatten[Import[...]] is enough.

POSTED BY: Sean Cheren
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