Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14811
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Running same code multiple times, while only changing two parameters |
| Date | 2015-01-06 00:28 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <m8fa7a$ppm$1@dont-email.me> (permalink) |
| References | <7a2f6bc8-1f1d-4e65-98ea-f9d4f80e8c0b@googlegroups.com> <m8cefl$35d$1@dont-email.me> <m8ch9f$35d$2@dont-email.me> <m8chgs$35d$3@dont-email.me> <4616b72a-9c1f-48d0-92f7-30a6c3e77352@googlegroups.com> |
On Mon, 05 Jan 2015 12:47:45 -0800, semeon.risom wrote:
> On Sunday, 4 January 2015 17:15:08 UTC-6, Denis McMahon wrote:
>> On Sun, 04 Jan 2015 23:10:39 +0000, Denis McMahon wrote:
>>
>> Two corrections are needed to this code:
>>
>> > for ($o = 30; $o < 61; $o += 5) // $orient values 30 .. 60
>> > for ($f = 0.2; $f < 0.9 $f += 0.2) { // $freq values 0.2 .. 0.8
>> .............................^
>>
>> insert ";" character
>>
>> > $fn = printf("gabor_patches/patch_%02d_%02d.png", $o, $f *
>> > 10);
>> ................^^^^^^
>>
>> sprintf
>>
>> > make_gabor($o, $f, $fn);
>> > }
>>
>> --
>> Denis McMahon, denismfmcmahon@gmail.com
>
> Sorry for the pestering questions, but if I wanted to paste the values
> into the syntax, would they be included like the example below?
>
> Note: I'm using Notepad++ to edit the syntax.
>
> Example: orient values: 30 28 42 98; freq values .30 .38 .37 .41 .......
> .......
> for ($o = 30 28 42 98; $o; < 61; $o += 5) // $orient values 30 .. 60
> for ($f = 0.2; $f; < 0.9 $f += 0.2) { // $freq values 0.2 .. 0.8
> $fn = sprintf("gabor_patches/patch_%02d_%02d.png", $o, $f * 10);
> make_gabor($o, $f, $fn);
No, the way I wrote the for loops is to step through a range of values in
a given increment.
If you want a non linear range, I suggest you create an array of values
and use a foreach loop to step through the array. Note that in this
example I'm also using 3 digit orient and freq in the file names, and
I've reduced the code inside the loop to a single statement (that will
wrap because of usenet limitations).
example:
$orients = array(30, 28, 42, 98); // all the orient vals
$freqs = array(.30, .38, .37, .41); // all the freq vals
foreach ($orients as $o)
foreach ($freqs as $f)
make_gabor($o, $f, sprintf("gabor_patches/patch_%03d_%03d.png",
$o, $f * 100));
--
Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
Running same code multiple times, while only changing two parameters semeon.risom@gmail.com - 2015-01-04 08:47 -0800
Re: Running same code multiple times, while only changing two parameters "J.O. Aho" <user@example.net> - 2015-01-04 19:13 +0100
Re: Running same code multiple times, while only changing two parameters semeon.risom@gmail.com - 2015-01-04 13:18 -0800
Re: Running same code multiple times, while only changing two parameters Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-01-04 20:58 +0000
Re: Running same code multiple times, while only changing two parameters semeon.risom@gmail.com - 2015-01-04 13:15 -0800
Re: Running same code multiple times, while only changing two parameters "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-04 23:21 +0100
Re: Running same code multiple times, while only changing two parameters Richard Damon <Richard@Damon-Family.org> - 2015-01-04 16:21 -0500
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-04 22:22 +0000
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-04 23:10 +0000
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-04 23:14 +0000
Re: Running same code multiple times, while only changing two parameters semeon.risom@gmail.com - 2015-01-05 12:47 -0800
Re: Running same code multiple times, while only changing two parameters semeon.risom@gmail.com - 2015-01-05 12:50 -0800
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-06 00:42 +0000
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-06 18:59 +0000
Re: Running same code multiple times, while only changing two parameters Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-06 00:28 +0000
csiph-web