Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Trouble With GUI Button
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I'm trying to set up a function that I can use to take a snapshot of something I work on before and after by pushing a button. Later I'm going to add something to append them together. My problem seems to be that I can only execute the print command once. I think it might be because it won't save over the new .ps file that I'm creating. I've tried the filename command to rename the files, but it doesn't seem to work. Also, I am having troubles changing the string of the button each time it is pushed. This is the section of code I'm having troubles with:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
count = 0
pushed = get(hObject, 'Value');
if count = 0
filename = 'Before.ps';
print('-dps','-s',gcs, filename);
count = 1;
set(hObject, 'String', 'After') ;
else
filename = 'After.ps';
print('-dps','-s',gcs, filename);
count = 0;
set(hObject, 'String', 'Before') ;
end
0 comentarios
Respuestas (2)
Image Analyst
el 31 de Mzo. de 2013
Make count global or persistent.
1 comentario
Image Analyst
el 1 de Abr. de 2013
Steve, regarding your "Answer", see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!