Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: copying values of entries between matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77985] Re: [mg77952] copying values of entries between matrices
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 21 Jun 2007 05:33:10 -0400 (EDT)
  • References: <200706200937.FAA10111@smc.vnet.net>

On Jun 20, 2007, at 5:37 AM, text.tex wrote:

> Hi,
> here is my problem:
> I have a 18x18 matrix called entMatr.
> I want to copy the values of the elements of the lower left half of
> entMatr into a 171x1 matrix called dOneCol.
> I had tried a 3-nested loop for copying the values from entMatr to
> dOneCol; the current version where I tried to replace the loop over
> the rows of dOneCol with a counter q produces a result, however the
> result is not what I want...
>
> I'd greatly appreciate any pointers how to get this working!

One immediate problem is that the first element of a list in  
Mathematica has index 1 not 0.  The code you sent looks like a  
straightforward translation of C code, which is not generally a good  
match to Mathematica style.

Here's an alternative way to generate entMatr;

entMatr=Array[If[#2<=#1,#2,Subscript[m,#1,#2]]&,{18,18}]

You can extract the matrix elements as follows:

dOneCol=Flatten[Table[entMatr[[j,i]],{i,18},{j,i,18}],1]

Regards,

Ssezi


  • Prev by Date: Re: Same Limit: OK in 5.2, fails in 6.0; Packages gone in 6.0 ???
  • Next by Date: Re: copying values of entries between matrices
  • Previous by thread: copying values of entries between matrices
  • Next by thread: Re: copying values of entries between matrices