help-octave
[Top][All Lists]
Advanced

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

Re: [newbie] constructing a discrete dataset


From: c.
Subject: Re: [newbie] constructing a discrete dataset
Date: Wed, 29 Jan 2014 17:30:27 +0100

> On 29 Jan 2014, at 17:07, Jean Dubois <address@hidden> wrote:
> 
>> I'd like to generate every possible combination a b c d e f for three
>> possible values (1, 2, 3) of each variable
>> Something which starts like this:
>> 1 1 1 1 1 1

On 29 Jan 2014, at 17:25, c. <address@hidden> wrote:

> If I understand correctly what you want to do is count fro 0 to 3^7-1 in base 
> 3:
oops, you actually wanted 6 digits, not 7, so that's 3^6-1, not 3^7-1:

ii = [0:3^6-1].';
for jj = 1:6
  digit(:, jj) = fix (ii / 3^(6-jj));
  ii -= digit(:, jj) * 3^(6-jj);
endfor
digit += 1;

c.

reply via email to

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