Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello!
Is it possible to do the following:
I have two matrices, say 5x1, but want to perform computation using 4 elements of both matrices. In other words I want to omit one row (value) form the computation. The result will be vectorized.
Best regards,
Sergey
Solved! Go to Solution.
So I think that trimming the final result seems to be the best way to do. But not using my 'deleteRow' but rather the built-in 'trim' 🙂
--------------------------------
Спасибо за методику. Протестирую
Сергей
For the special case of two vectors you could use something like this
This works as long as the original vectors do not contain any NaN's.
A more generic approach is the use of submatrix. But I would rather apply it to the result and not to the input vectors.
Problem with submatrix is that it needs some special treatment if you want to omit the very first or the very last row.
So it would be beneficial to use a utility function which deletes any row from an arbitrary matrix.
Unfortunately you don't explain why you would want to omit a specific row.
If you want to omit a specific row because this would throw an error like in
the aforementioned methods will not work and it would be necessary to omit the offending row before applying the operation.
Using the utility function shown above this could be done that way:
Looks like I tried to re-invent the wheel 😞
There is no need for a custom made utility function "deleteRow(M,r)' because the built in function "trim(M,r)" does the very same job and you could also use it to omit more than just one row:
"Unfortunately you don't explain why you would want to omit a specific row" - I will try to explain.
I have a parameter in my calculations. Say, q=100mm. This parameter is a part of an equation. But I want to perform the computation of the several cases simultaneously when q=100mm, 200mm, 300mm and so on. That is why I use 5x1 matrix. But in one case, I want to ommit the value of q=200mm because this is meaningsless in my case. This is the prime reason of me asking about the omiting technique in Mathcad using matrix operators.
So I think that trimming the final result seems to be the best way to do. But not using my 'deleteRow' but rather the built-in 'trim' 🙂
Looks like the solution I need.
Sergey
