MathGroup Archive 2006

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

Search the Archive

Re: matrix operations -- shared data vs copied


If you don't want to use the data manipulation package, you could try:

letters={{a,b},{c,d}};
letterpos=Flatten[MapIndexed[#2&,letters,{2}],1];
numbers={{0,0,1},{0,1,0},{1,0,0}};
newmatrix=ReplacePart[numbers,letters,{1,1}+#&/@letterpos,letterpos];

MatrixForm[letters]
MatrixForm[numbers]
MatrixForm[newmatrix]


  • Prev by Date: Re: How to extract functions from a list and call them with any argument?
  • Next by Date: Re: How to extract functions from a list and call them with any argument?
  • Previous by thread: Re: matrix operations -- shared data vs copied
  • Next by thread: Re: matrix operations -- shared data vs copied