Mercurial > hg > medcouple
diff talk/code/showalgo.m @ 74:305b7361a5bd default tip @
showalgo: save a snapshot instead of waiting for keyboard input
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sun, 29 May 2016 19:05:01 -0400 |
parents | 7bcf3d503d33 |
children |
line wrap: on
line diff
--- a/talk/code/showalgo.m +++ b/talk/code/showalgo.m @@ -20,7 +20,14 @@ graphics_toolkit fltk; figure -pause + + +function snapshot() + persistent x = 1; + fname = sprintf("%02d.png", x); + print("-dpng", fname); + x++; +endfunction for iter = 1:length(Am) if iter > rows(L) @@ -42,7 +49,7 @@ printf("Remaining: %d\n", remaining(iter)) imshow(imgH); - pause + snapshot; ## Make the guess yellow [i,j] = find(Am(iter) == H); @@ -50,7 +57,7 @@ imgH(i,j,3) = 0; imshow(imgH); - pause + snapshot; if iter == length(Am) break @@ -80,7 +87,7 @@ imgH(i,j,3) = 0; imshow(imgLeft); - pause + snapshot; ## Check the right side imgRight = imgH; @@ -105,16 +112,16 @@ imgH(i,j,1) = imgH(i,j,2) = 1; imgH(i,j,3) = 0; imshow(imgRight); - pause + snapshot; imshow(imgH); printf("rank is between %d and %d (target: %d)\n", Ptot(iter), Qtot(iter), medc_idx) - pause + snapshot; endfor if (jackpot) printf("Jackpot!\n") endif -pause +snapshot;