Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi,
is there a simple way to do this i.e. without looping around each element I want to assign
e.g. given V=[a,b,c,d,e,f] and W=[g,h]
produce X=[a,g,h,d,e,f] or similar
Thanks
You can slice out part of a matrix (vector) using submatrix command
You can put matrices (vectors) together with stack and augment.
Thanks,
So I would have to extract the submatrices (bits either side and the bit being overwritten) and reconstruct with the new submatrix. Doesn't sound too bad. I was doing this in a program but I was able to directly overwrite a submatrix using a range variable outside of a program thus:
given a=3x3 and b=2x1
r:1;2
a[r,1:b[r-1
I was doing this in a program but I was able to directly overwrite a submatrix using a range variable outside of a program thus:
given a=3x3 and b=2x1
r:1;2
a[r,1:b[r-1
You can do that in a program as well, but you would have to use for-loops in place of the ranges. Range variables at the end are nothing but implicit for-loops anyway.
Look at my other post for this.The routine there is ORIGIN aware.
Not quite sure what you are after and if you are just dealing with vectors or with general matrices.
Anyway I hope that the attched sheet in MC11 format will help.
Two different ways to deal with vectors and a more general all purpose routine you could use with matrices as well.
As I remember from other posts of yours that you are using MC 2001, I include a pic of the file as well.
Many thanks for your help. My original thinking was that if there is a function for submatrix extraction then surely there must be a matching "implant". I'm working with wav files so large row count and 2 columns (for stereo), and was trying to keep my program efficient and elegant.
D
then surely there must be a matching "implant".
Now you have it 😉
If you work with large matrices and want to be efficient it will be good to know that submatrix and especially stack and augment are working MUCH slower than self writen routines using for-loops. Thats strange and hard to understand but its a fact. So try to avoid those commands and replace them by more elaborate loops.
That is strange - one would think they'd be optimized... but thanks very much for the heads up 😉
Re 2001i - just waiting for go-ahead to purchase Prime but a little bemused by some of the recent comments (I know that is a different subject)
I tried Prime 2 and didn't bother downloading version 3 yet so concerning P3 I have to rely on what was announced and what is reported here. But from all that I am still convinced that the best thing about Prime is that you get Mathcad 15 free with it.