How to make next page in GUI
Show older comments
Hello
I am making image browser and I have problem with button Next Page everytime when I press button next page I want to show next 12 images and I am using this code:
for j = (jj+1) : (2*jj)
[I cmap] = imread(img(j),'frames','all');
ax=subplot(4,3,(j-12));
image(I);
colormap(ax,cmap);
axis off;
axis image;
end
where jj=12 first is showen 12 images and pressing Next Page button there should be displayed next 12. This code works when I press button Next Page first time after I run GUI but it doesn't work when I hit it second or third time...What should I do to display 12 new images every time I hit button Next Page
Thank you!
Accepted Answer
More Answers (2)
Sean de Wolski
on 30 Dec 2014
0 votes
I probably doesn't remember what j is.
Put a breakpoint on the line that isn't working, run it, and see what the variables are as you press the button.
3 Comments
Lolipop
on 30 Dec 2014
Sean de Wolski
on 30 Dec 2014
So put a break point on the imread line. Press next page, step through, is what you expect to happen, happening? If not, why not? If so, press it again and repeat until you see a discrepancy between expectations and reality.
web(fullfile(docroot, 'matlab/matlab_prog/debugging-process-and-features.html'))
Working your way through this might be worth your time.
Lolipop
on 30 Dec 2014
Sean de Wolski
on 30 Dec 2014
Edited: Sean de Wolski
on 30 Dec 2014
probably
(j-12);
Which will not always be 1:12. Instead:
count = 0;
for j = jj:etc
count = count+1;
subplot(3,4,count)
etc.
end
NOTE with the debugger you would be able to walk through and see what each thing is on each step to avoid guessing.
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!