# select equal element between matrices

6 messages
Open this post in threaded view
|

## select equal element between matrices

 hi guys, a give you a difficult question a=[3 2 5 5 6 6 2 3] b=[0 1 0 0 1 1 0 0] c=["a","b","a","a","b","c","a","a"] I want combine each index with the others ans: 3 0 a 2 1 b 5 0 a 5 0 a 6 1 b 6 1 c 2 0 a 3 0 b I consider only the same pairs (3 0 a   and 5 0 a) returns the number index of equal pairs ans:[1 4] it's possibile to do this avoit loop? thank -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: select equal element between matrices

 >a=[3 2 5 5 6 6 2 3] >b=[0 1 0 0 1 1 0 0] >c=["a","b","a","a","b","c","a","a"] > >I want combine each index with the others > >ans: >3 0 a >2 1 b >5 0 a >5 0 a >6 1 b >6 1 c >2 0 a >3 0 b > >I consider only the same pairs (3 0 a   and 5 0 a) > >returns the number index of equal pairs >ans:[1 4] > >it's possibile to do this avoit loop? thank I see that you have not received any answer.  I think this is because your question is not clear.  At least, I have not understood it. Can you try to clarify what is your purpose? -- Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058 ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107 via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti (entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it
Open this post in threaded view
|

## Re: select equal element between matrices

 On 2/10/19 1:38 PM, Francesco Potortì wrote: >> a=[3 2 5 5 6 6 2 3] >> b=[0 1 0 0 1 1 0 0] >> c=["a","b","a","a","b","c","a","a"] >> >> I want combine each index with the others >> >> ans: >> 3 0 a >> 2 1 b >> 5 0 a >> 5 0 a >> 6 1 b >> 6 1 c >> 2 0 a >> 3 0 b >> >> I consider only the same pairs (3 0 a   and 5 0 a) >> >> returns the number index of equal pairs >> ans:[1 4] >> >> it's possibile to do this avoit loop? thank > > I see that you have not received any answer.  I think this is because > your question is not clear.  At least, I have not understood it. > > Can you try to clarify what is your purpose? > This looks like homework.  Look at num2str and consider a' Tom Dean
Open this post in threaded view
|

## Re: select equal element between matrices

 In reply to this post by Francesco Potortì Hi francesco thank you for answer i've this vector: a=[3 2 5 5 6 6 2 3] b=[0 1 0 0 1 1 0 0] c=["a","b","a","a","b","c","a","a"] i want to concatening element of string: column 1: a(3)+b(0)+c("a") = 30a column 2: a(2)+b(1)+c("b") = 21b column 3: a(5)+b(0)+c("a") = 50b … -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html