Message Boards Message Boards

GROUPS:

Manipulating data from a xlsx file?

Posted 2 years ago
1507 Views
|
1 Reply
|
0 Total Likes
|

Hi I have a question about manipulating lists from an xlsx file you see I imported a list from a file

In[1]:= accesos = Import["C:\Users\Hansel\Desktop\Datos.xlsx"][[1]]

Out[1]= {{"A1", 20.5948, -100.411}, {"A2", 20.5945, -100.411}, {"A3", 
  20.5945, -100.41}, {"A4", 20.5941, -100.411}, {"A5", 
  20.5941, -100.411}, {"A6", 20.5941, -100.412}, {"A7", 
  20.5938, -100.412}, {"A8", 20.5937, -100.413}, {"A9", 
  20.5936, -100.412}, {"A10", 20.5935, -100.412}, {"A11", 
  20.5934, -100.412}, {"A12", 20.5933, -100.412}, {"A13", 
  20.5932, -100.413}, {"A14", 20.5931, -100.413}, {"A15", 
  20.5929, -100.412}, {"A16", 20.5929, -100.412}, {"A17", 
  20.5929, -100.413}, {"A18", 20.593, -100.413}, {"A19", 
  20.5926, -100.413}, {"A20", 20.5926, -100.413}, {"A21", 
  20.5925, -100.412}, {"A22", 20.5925, -100.409}, {"A23", 
  20.5924, -100.413}, {"A24", 20.5924, -100.414}, {"A25", 
  20.5923, -100.409}, {"A26", 20.5922, -100.409}, {"A27", 
  20.5922, -100.41}, {"A28", 20.5921, -100.411}, {"A29", 
  20.5921, -100.41}, {"A30", 20.592, -100.409}, {"A31", 
  20.592, -100.412}, {"A32", 20.592, -100.41}, {"A33", 
  20.592, -100.409}, {"A34", 20.592, -100.409}, {"A35", 
  20.5919, -100.409}, {"A36", 20.5919, -100.412}, {"A37", 
  20.5919, -100.41}, {"A38", 20.5919, -100.408}, {"A39", 
  20.5918, -100.408}, {"A40", 20.5919, -100.412}, {"A41", 
  20.5919, -100.411}, {"A42", 20.5918, -100.411}, {"A43", 
  20.5917, -100.409}, {"A44", 20.5916, -100.41}, {"A45", 
  20.5916, -100.408}, {"A46", 20.5915, -100.412}, {"A47", 
  20.5915, -100.411}, {"A48", 20.5914, -100.412}, {"A49", 
  20.5914, -100.409}, {"A50", 20.5913, -100.413}, {"A51", 
  20.5912, -100.412}, {"A52", 20.5912, -100.409}, {"A53", 
  20.5911, -100.413}, {"A54", 20.5911, -100.412}, {"A55", 
  20.591, -100.413}, {"A56", 20.591, -100.413}, {"A57", 
  20.5909, -100.413}, {"A58", 20.5909, -100.412}, {"A59", 
  20.5909, -100.412}, {"A60", 20.5909, -100.411}, {"A61", 
  20.5908, -100.411}, {"A62", 20.5907, -100.411}, {"A63", 
  20.5907, -100.412}, {"A64", 20.5907, -100.409}, {"A65", 
  20.5906, -100.41}, {"A66", 20.5906, -100.413}, {"A67", 
  20.5905, -100.409}, {"A68", 20.5905, -100.411}, {"A69", 
  20.5904, -100.41}, {"A70", 20.5904, -100.412}, {"A71", 
  20.5903, -100.41}, {"A72", 20.5903, -100.41}, {"A73", 
  20.5903, -100.409}, {"A74", 20.5904, -100.413}, {"A75", 
  20.5902, -100.411}, {"A76", 20.5902, -100.409}, {"A77", 
  20.5902, -100.411}, {"A78", 20.5902, -100.411}, {"A79", 
  20.5901, -100.411}, {"A80", 20.5901, -100.41}, {"A81", 
  20.5901, -100.41}, {"A82", 20.5901, -100.409}, {"A83", 
  20.5901, -100.412}, {"A84", 20.59, -100.412}, {"A85", 
  20.5899, -100.413}, {"A86", 20.5899, -100.413}, {"A87", 
  20.5899, -100.412}, {"A88", 20.5898, -100.41}, {"A89", 
  20.5898, -100.41}, {"A90", 20.5897, -100.412}, {"A91", 
  20.5896, -100.412}, {"A92", 20.5896, -100.411}, {"A93", 
  20.5894, -100.41}, {"A94", 20.5894, -100.41}, {"A95", 
  20.5914, -100.407}, {"A96", 20.5914, -100.407}, {"A97", 
  20.5908, -100.407}, {"A98", 20.5908, -100.407}, {"A99", 
  20.5908, -100.406}, {"A100", 20.5908, -100.406}, {"A101", 
  20.5907, -100.406}, {"A102", 20.5906, -100.407}, {"A103", 
  20.5904, -100.407}, {"A104", 20.5903, -100.407}, {"A105", 
  20.5902, -100.406}, {"A106", 20.5903, -100.406}, {"A107", 
  20.5902, -100.407}, {"A108", 20.5902, -100.407}, {"A109", 
  20.5902, -100.406}, {"A110", 20.5901, -100.407}, {"A111", 
  20.5901, -100.407}, {"A112", 20.5901, -100.406}, {"A113", 
  20.59, -100.407}, {"A114", 20.59, -100.407}, {"A115", 
  20.5897, -100.407}, {"A116", 20.5906, -100.406}}

is there a way to make it variables so it s like this:

A1 = {20.59479818`, -100.41053396`}

A2 = {20.5945245`, -100.41064594`}

or even better

A1 = {lat: 20.59479818`, long: -100.41053396`}

A2 = {lat: 20.5945245`, long: -100.41064594`}
Posted 2 years ago

.

In[1]:= accesos = {{"A1", 20.5948, -100.411}, {"A2", 20.5945, -100.411}, {"A3", 20.5945, -100.41}};
Map[ToExpression[#[[1]]<>"=\"{lat: "<>ToString[#[[2]]]<>", long: "<>ToString[#[[3]]]<>"}\""] &, accesos];
A2

Out[3]= "{lat: 20.5945, long: -100.411}"
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