Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
Say I have a matrix called Y that is (21x21) and I have matrix A that is (3x3). I would like to have matrix A placed in Y starting at Y1,1 so that
Y11=A11
Y12= A12
Y13=A13
Y21=A21
Y22=A22
Y23=A23
Y31=A31
Y32=A32
Y33=A33
I am new to using mathcad, thanks for the help.
Hi,
Prime 4 and MathCad implementation
Arrays start index is 0 by default, to establish Y as a 21x21 matrix, set the last element to zero.
Enter an arbitrary A matrix.
Set up two range variables to operate over the matrices.
Using the range variables enter A into Y at correct location.
example...
I assume you want 1,1 to be the origin of the array, in which case you should be aware that in Mathcad the default origin is 0,0. You can chnage it to 1,1 though.
Given that, you can do what you ask using a couple of range variables:
if that does not solve your problem, then we need more infomation about what you wish to do.
and if you were to place the A matrix in the middle of your 7x7?
Then, using Richard's method, you would write the expression ZAn+2,m+2:=An,m
Success!
Luc
Personally I would prefer using a small utility routine to do the job. Especially if you need to do it more than once and for different insert positions.
Here is a quick hack. Its ORIGIN aware, so you can use it without changes in a sheet which hast ORIGIN set to 1 instead od the default 0. But the routine lacks error checking - e.g. for wrong indices. If you provide an insertion index which is lower than ORIGIN, you will get an errror from Mathcad. If you provide an insertion index which is to big, then the resulting matrix will be extended and the new positions filled with zeros. In the example, Insert(A,Y,19,20) will result in a 22 x 23 matrix instead of the 21 x 21. You would have to state what should happen in this case. Either an error message or inserting A only partial so that the result is still 21 x 21.
Here are some variants with rudimentary error checking: