I have been trying to get a simple GUI going. It has one button group with
three radio buttons.
Pressing buttons 1 or 2 is intended to imagesc() one of the matrices in the
last two function arguments. Button 3 should display their difference when
pressed. That does not happen, though. Instead, the GUI displays what should
have been shown by the *previous* selection. For example, if I press button
2 and then button 3, it displays what button 2 should have displayed, even
though button 3 is checked.
Also, I had thought that radio button groups are supposed to have one
selection active at all times. That is not the case here. I have to set the
Value field of one button to 1 manually, otherwise none of them will be
I have tried messing around with ButtonDownFcn, setting the Enable field to
"off" as suggested in other threads, etc. -- nothing seems to work
It has been many years since I wrote an Octave GUI, so I am probably making
some rookie mistake, but can't figure it out for the life of me. I am
running Octave 4.4.1 on Centos. Anyways, here's the code:
I am top posting because the last post in this thread (the one containing code) has no context.
The callback function is called for the deselected button and the newly selected button (add a line to display Asm in your callback and you will see that it is displayed twice every time you select a new button). An easy fix is to change your callback to:
function cbackfcn(src, eventdata, ax1, Asm)
if(get(src,"value") == 1)
This ensures that the image corresponding to the newly selected button is shown.
Thanks for your help Tony. I did notice that the callback function was
running twice each time, and had figured out why that was, but never thought
of using the Value field to discriminate between the two calls.