Borrar filtros
Borrar filtros

How do i add buttons in my output image??

11 visualizaciones (últimos 30 días)
bhavani
bhavani el 25 de Mayo de 2015
Editada: Jan el 25 de Mayo de 2015
I am having more number of outputs. if i run my program i got outputs which arises continuously. For that i need to some control for displaying my outputs. i wish to add some NEXT and BACK button in my output images. How can i add those buttons on my image.

Respuestas (3)

Image Analyst
Image Analyst el 25 de Mayo de 2015
I think it would be best to just position the buttons below the image.
You might try this: MAGIC

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh el 25 de Mayo de 2015
You need to make a GUI perhaps, and the easiest way is to use MATLAB Graphical User Interface Design Environment (guide).
Type doc guide in the command line and figure out how to create a GUI with push buttons.
doc guide
Good luck!

Jan
Jan el 25 de Mayo de 2015
Editada: Jan el 25 de Mayo de 2015
You can add two buttons and some code to remember the handles of the previous and next figures:
function yourFigureCreation
previousFigH = [];
for k = 1:10
Handles.FigH = figure('IntegerHandle', 'off', 'NumberTitle', 'off', ...
'Name', sprintf('Figure %d', k));
Handles.BackH = uicontrol('Style', 'PushButton', 'String', 'Back', ...
'Position', [5, 5, 80, 22], ...
'Callback', {@SelectFigure, 'Back'});
Handles.NextH = uicontrol('Style', 'PushButton', 'String', 'Next', ...
'Position', [90, 5, 80, 22], ...
'Callback', {@SelectFigure, 'Next'});
Handles.PreviousFigH = previousFigH;
Handles.NextFigH = [];
if isempty(previousFigH)
set(Handles.BackH, 'Enable', 'off');
else
previousHandles = guidata(previousFigH);
previousHandles.NextFigH = Handles.FigH;
guidata(previousFigH, previousHandles);
end
guidata(Handles.FigH, Handles);
previousFigH = Handles.FigH;
end
set(Handles.NextH, 'Enable', 'off');
function SelectFigure(ObjectH, EventData, Command)
Handles = guidata(ObjectH);
switch Command
case 'Next'
toOpen = Handles.NextFigH;
case 'Back'
toOpen = Handles.PreviousFigH;
otherwise
error('Bad switch: Programming error!'); % Never omit the OTHERWISE
end
if ishandle(toOpen)
figure(toOpen);
else % The wanted figure has been deleted already - disable the button:
set(ObjectH, 'Enable', 'off');
end

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by