[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clearing intermediate variables at end of functions?
From: |
Daniel J Sebald |
Subject: |
Re: clearing intermediate variables at end of functions? |
Date: |
Sat, 30 Aug 2014 00:59:00 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 08/30/2014 12:26 AM, Daniel J Sebald wrote:
It might be interesting to extend the nchoosek() function to cells, but
the problem is that the cell presentation doesn't lend itself to showing
the groupings. For example, say there are four balls (red, green,
yellow, black), two chosen with replacement:
OBJECTS = {'Red' 'Green' 'Yellow' 'Black'}
OBJECTS =
{
[1,1] = Red
[1,2] = Green
[1,3] = Yellow
[1,4] = Black
}
I = nchoosek([1:4], 2)
I =
1 2
1 3
1 4
2 3
2 4
3 4
OBJECTS(I)
ans =
{
[1,1] = Red
[2,1] = Red
[3,1] = Red
[4,1] = Green
[5,1] = Green
[6,1] = Yellow
[1,2] = Green
[2,2] = Yellow
[3,2] = Black
[4,2] = Yellow
[5,2] = Black
[6,2] = Black
}
So, nchoose(OBJECTS, 2) would have the result above. That seems more
likely to be used as opposed to something like:
nchoosek([12 23 75 223], 2)
ans =
12 23
12 75
12 223
23 75
23 223
75 223
If only the cell contents could be presented in a matrix format. (A GUI
could certainly use table presentation for cells.)
Just a thought,
Dan