help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to simplified a splitting and comparison commands


From: Francesco Potortì
Subject: Re: Need to simplified a splitting and comparison commands
Date: Thu, 13 Oct 2011 17:24:56 +0200

Faizal:
>>> Yes I have a list of R of 100 random integers and I need to split it into
>>> "n" size of frame (in my example is n=5) and no I did not have definite
>>> interval. I just split it into frame as shown in my example.
>>> Also yes I need to do intersect between frame to find common numbers. If it
>>> has no common number it will show 0 or it will stop if next intersection is
>>> empty. and the end result it will display common number.  So that is what I
>>> want to achieve.  If there is a function or loop or if command I can use to
>>> simplified to get the result I want.
>>> Below is the illustration diagram that I want to built.  Hope this
>>> explanation is clear to you or other the reader
>>>
>>> http://octave.1599824.n4.nabble.com/file/n3900899/tree_matrix.jpg

Juan Pablo Carbajal:
>> I still do not understand why you need to do 2 list comparison. You
>> could do 1st against 2nd, result against 3rd, result against 4th..and
>> so on until result is empty or there are no more lists.

The results are different.  Finding the common numbers among all is
trivial, just use a logical matrix, but it seemes that Faizal wants
something different, which I do not understand either.

However, to find the integer numbers from 0 to 9 common to 4 randomly
chosen arrays of length 9 you do:o


octave> D=floor(10*rand(4,9))
D =

   5   6   1   9   5   3   0   7   7
   5   0   6   0   2   7   7   6   1
   2   4   3   2   6   2   9   2   7
   3   9   4   1   7   6   2   7   4

octave> L=false(rows(D),10); for r=1:rows(D) L(r,1+D(r,:))=true; endfor; L
L =

   1   1   0   1   0   1   1   1   0   1
   1   1   1   0   0   1   1   1   0   0
   0   0   1   1   1   0   1   1   0   1
   0   1   1   1   1   0   1   1   0   1

octave> find(all(L))-1
ans =

   6   7

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

[Prev in Thread] Current Thread [Next in Thread]