[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need to simplified a splitting and comparison commands
From: |
Juan Pablo Carbajal |
Subject: |
Re: Need to simplified a splitting and comparison commands |
Date: |
Thu, 13 Oct 2011 14:49:13 +0200 |
On Thu, Oct 13, 2011 at 2:45 PM, Juan Pablo Carbajal
<address@hidden> wrote:
> On Thu, Oct 13, 2011 at 10:39 AM, Faizal <address@hidden> wrote:
>> Thank you Mr Juan for response.
>>
>> 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
>>
>> Thank you
>>
>> --
>> View this message in context:
>> http://octave.1599824.n4.nabble.com/Need-to-simplified-a-splitting-and-comparison-commands-tp3896923p3900899.html
>> Sent from the Octave - General mailing list archive at Nabble.com.
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>>
>
> 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.
>
> Lets say you organized your k lists into one matrix M of n-by-k where
> n is the length of the lists (assuming they are all equal, if not pad
> with NaN or a negative number or whatever is not among your random
> integers).
> That is the i-th list is M(:,i).
>
> Then you can do
>
> result = M(:,1);
> for i = 2:k
> r = intersect (result, M(:,i));
>
> if isempty ( r )
>
> break
> end
>
> result = r;
> end
>
> if
> --
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Zürich
> http://ailab.ifi.uzh.ch/carbajal/
>
Sorry, I clicked by accident...
So continuing. that there will give you the common elements among all
the lists only if i reaches k without executing the break command.
If you wan to do comparisons two by two, you can prepare your indexes
before hand and loop through them. I am almost sure that some clever
computer scientist can give you a better algorithm, but fro sure this
is easy to program. Just use indexes cleverly!
Regards,
--
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/
- Need to simplified a splitting and comparison commands, Faizal, 2011/10/12
- Re: Need to simplified a splitting and comparison commands, Francesco Potortì, 2011/10/12
- Re: Need to simplified a splitting and comparison commands, Juan Pablo Carbajal, 2011/10/12
- Re: Need to simplified a splitting and comparison commands, Faizal, 2011/10/12
- Re: Need to simplified a splitting and comparison commands, Juan Pablo Carbajal, 2011/10/12
- Re: Need to simplified a splitting and comparison commands, Faizal, 2011/10/13
- Re: Need to simplified a splitting and comparison commands, Juan Pablo Carbajal, 2011/10/13
- Re: Need to simplified a splitting and comparison commands,
Juan Pablo Carbajal <=
- Re: Need to simplified a splitting and comparison commands, Francesco Potortì, 2011/10/13
- Re: Need to simplified a splitting and comparison commands, Faizal, 2011/10/13