image disappears when the button is not clicked

Hello,
I make a simple GUI on matlab with the button, but the image only appears when i click on the button, and the image disappears when i don't click on the button, there is only black image as the background.
Please help me in out from this error. Thanks

11 Comments

Please show the parts of your code that have to do with showing the image.
What error? It seems like it's operating like it's supposed to. It starts with a black image window, then when you click a button you display the image. Isn't that what you wanted? What is the error message? http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
this is the parts of code
function test_Callback(hObject, eventdata, handles)
% hObject handle to ekstraksiciri (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
crop=handles.crop;
axes(handles.axes1);
image=takepicture(crop);
axes(handles.axes2);
imshow(image);
handles.image=image;
guidata(hObject, handles);
the white line appears very quickly when it's clicked and then disappear again. it just like once click->once appears then disappear, so on. so,it just looked the black background only http://i1338.photobucket.com/albums/o690/Tedy_Frank/img2_zps80d6e87f.jpg
there is no error message, I am so confused
Using "image" as a variable name is going to cause you problems.
What white line? Your code does not have any lines.
Are your two axes overlapping ?
"takepicture" is a function that result the white line like that. there is no error with the function, i've checked out the function separately,and it works. so, i think there is no axes overlapping.
perhaps you want to add
drawnow()
after the takepicture() call.
it doesn't work. still the same
when i add drawnow(), the output give the overlapping image. when i click the button, it display a image and when i click again,it also display image that overlapping each other,so on.
At the moment we have no reason to know that the axes are not overlapped, and no reason to know that "hold" is not on on the axes.
@tedy: Please edit the original question and insert enough details to allow an answer. Currently the readers have to guess to many details. Thanks.
Can you upload a zip with the fig file, the m-file, and the images?

Sign in to comment.

Answers (0)

Tags

Asked:

on 15 Mar 2013

Community Treasure Hunt

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

Start Hunting!