Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

extracting column data from 2D Matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23412] extracting column data from 2D Matrix
  • From: "Krautschik, Chris G" <krautschikc at intel.co.jp>
  • Date: Sun, 7 May 2000 21:17:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have a 2D Matrix of say 101 columns and 1000 rows. Let's call the data
matrix xyDATA. The first column represents the X coordinate and all other
columns represent Y coordindates for different input conditions.

Let's say I need to extract every 10th y column as well as the X column (1st
column) so I can plot the data in another program. I have been using the
following expression for the extraction process:

colmnIndex={#1, #11,#21,#31#41,#51,#61,#71,#81,#91,#101};
xy10 = columIndex & @@@ xyDATA;

How do I automate the process for the column Index without have to type it
each time? That is perhaps something like the following I had in mind:

yindex= #*Table[i,{1,101,10}];
columnIndex2=Append[{#1},yindex];

This though doesn't seem to work even when I used:

ToExpression[columnIndex2]

or tried various other string to expression schemes.

Also I like to average each 10 consequitive rows. That is I have written a
RowMean function that generate the column vector of the 1000 elements. How
do I then insert after each 10 y column the columns that holds the average?
So the matrix now grows from 101 colums to 111 colums (still 1000 rows) but
the averaged columns need to be inserted at (12,22,33,...).

thanks,
Chris




  • Prev by Date: Is GenerateConditions working properly in my version 3?
  • Next by Date: Modifying Fit[] using SingularValues
  • Previous by thread: Is GenerateConditions working properly in my version 3?
  • Next by thread: Re: extracting column data from 2D Matrix