cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

I want to combine different 2 vecctors

jlee-2
7-Bedrock

I want to combine different 2 vecctors

34.PNG

Hello.

I had a question.

I want to make "C" by plusing A and B

It means that "B" from 2 rows(5) should add under 4 rows in "A" automatically.

Could you help me?

7 REPLIES 7
Werner_E
25-Diamond I
(To:jlee-2)

C:=stack(A,B)

jlee-2
7-Bedrock
(To:Werner_E)

Thank you for helping.

But I want to get result's values without duplication.

I got same value "4"

Werner_E
25-Diamond I
(To:jlee-2)

jinsuk Lee wrote:

Thank you for helping.

But I want to get result's values without duplication.

And sorted, too?

There will be no specific command in Mathcad to do so and it will require a samll program. You will have to specify your needs in more detail. As it looks to me now its not a matter of combining two vectors but rather a problem of removing duplicates from a single vector. I think you will have to provide more different examples to make it clear.

E.g. what about A=(3,6,3,2) B=(7,1,7,3) What result do you expect? C=(1,2,3,6,7) or C=(3,6,2,7,1) or what else?

StuartBruff
23-Emerald III
(To:Werner_E)

Unfortunately, I'm Mathcadless at the moment, but if you look in the worksheet I've attached to this message http://communities.ptc.com/message/266834#266834 I hope you will find the functions set and setcount in the collapsed Utilities Area. set (stack (A, B)) should do the trick. set sorts, though ... I do have a version that doesn't sort somewhere that checks if an element is in the 'set' vector (initialized to the first element of the input vector) and adds the element of it isn't., but I don't know where it is.

Stuart

jlee-2
7-Bedrock
(To:Werner_E)

Thank you.

I settle finally to use "submatrix"

so you don't need to think about my question anymore.

Thank you for consideration.

VladimirN
24-Ruby II
(To:jlee-2)

How about this solution:

Pic_1.png

thank you for consideration.

Announcements

Top Tags