Re: ReadList and columns
- To: mathgroup at smc.vnet.net
- Subject: [mg73922] Re: ReadList and columns
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 3 Mar 2007 01:03:07 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <es91ti$3e5$1@smc.vnet.net>
Mary Beth Mulcahy wrote: [...snip...] > input: au1[[All,{1}]] > output: {{350},{360},{370},{380},{390}} > > input: au1[[All,{2}]] > output: {{0.00023179},{0.0038609},{0.0075302},{0.008159},{0.0076243}} > > And when I try and transpose the lists (Transpose[au1[[All,{1}]], au1[[All, > {2}]]]) I get an error message saying the dimensions of my array are > incorrect. > > I know that I need Mathematica to read my columns like this: > {350,360,370,380,390} without the extra curly brackets and which I believe > would be a single array, but I can't figure out how to do it. I would > really appreciate any help. > > Sincerely, > Mary Beth Mulcahy > Transpose first, then extract the desired column(s). For instance, In[1]:= au1 = {{350, 0.00023179}, {360, 0.0038609}, {370, 0.0075302}, {380, 0.008159}, {390, 0.0076243}}; In[2]:= au1[[All,{1}]] Out[2]= {{350}, {360}, {370}, {380}, {390}} In[3]:= au1[[All,{2}]] Out[3]= {{0.00023179}, {0.0038609}, {0.0075302}, {0.008159}, {0.0076243}} In[4]:= Transpose[au1][[1]] Out[4]= {350, 360, 370, 380, 390} In[5]:= Transpose[au1][[2]] Out[5]= {0.00023179, 0.0038609, 0.0075302, 0.008159, 0.0076243} Regards, Jean-Marc