Using one save button(push button) instead of two?

Hi,
I'm using "two push buttons" to run two independent functions. Let's say one for "process1" and for the other one "process2". If "process1" works, "process2" doesn't work and if "process2" works, "process1" doesn't work. Thats OK and what I want. Then I want to save the output which is done/worked succesfully by using ONE push button (save button). Lets say the output of process1 is "mat1" and the output of the other process is "mat2" I tried to use some "if" commands but it didn't work. Is it possible to do that with one push button or do I have to do this with 2 buttons for each process?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 3월 1일

0 개 추천

Have you tried a toggle button?

댓글 수: 5

Huseyin commented
No, I haven't because I have to do it with push button. Is it possible?
You can do it by saving a variable that indicate which process is off or on
handles.process=1 % indicates process1 is on
guidata(hObject,handles)
Yes it worked!
I also have tried "handles.process=1" before but I didn't add the line "guidata(hObject,handles)" and it didn't worked. Now I added it and everyting is ok now. Can you please explain what does the second line mean?
guidata(hObject,handles)
update handles, you can use its content in other functions by
v=handles.process
Thanks a lot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2014년 3월 1일

댓글:

2014년 3월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by