Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Curious
Posts:
2,190
Registered:
12/6/04


Re: GUI: Change plot in axes depending on the combination of two buttons
Posted:
Nov 26, 2012 1:57 PM


"someone" wrote in message <k90dqt$p42$1@newscl01ah.mathworks.com>... > "Mateusz" wrote in message <k8vj5g$ecg$1@newscl01ah.mathworks.com>... > > Hello, > > > > I'm creating a GUI to visualize OFDM signal processing. My problem is weird. > > > > I have nine togglebuttons (let's name buttonX, where X is the number of each button))to change the block of OFDM scheme (for example Symbol Mapping or IFFT). Next to those, there is additional four togglebuttons to change the plot (time domain, frequency domain, constellation or BER noise figure). > >  > > In Callbacks of every togglebutton i wrote: > > > > plots(handles); % it's a function to change plot depending on the combination of togglebuttons (for example when 'Value' of (button1 == 1 && buttonP1 == 1), then plot ofdm spectrum ; when (button1 == 1 && buttonP2 == 1), then plot time domain ofdm signal, and so on). > > > > visibility(handles); % it's a function to change 'Enable' of the togglebuttons (for example I don't need constellation scatterplot in the IFFT block). > > > > guidata(hObject, handles); > >  > > > > It works fine, when There is only one condition (Button1 == 1), for example Button3 shows stem of bits. > > But when I want to see the spectrum of OFDM signal(in Button1 I have Enabled two additional ButtonP1 and ButtonP2 for plot frequency and time domain signal)  click Button1 and then ButtonP1.. it's not working. I have to set ButtonP1 "1", then click different buttonX and finally click Button1 again. Now I have my plot. > > What is wrong? How can I refresh Button1 (because I'm guessing that function plots(handles) just cant get value of the Button1 after I clicked ButtonP1. > > > > I hope It's understandable. Please help me. > > > > I apologize for my English. If there is something not clear, I will try to explain my problem different way. > > I'm not sure I completely understand, but I'll try. > > First, are you sure ALL the togglebutton values are "mutually exclusive"? > That is, if one button value is 1, are the others zero? > If not, what do you want to have happen if > button1 == 1 && buttonP1 == 1 && buttonP2 == 1 for example? > > Second, the button logic might be a little more clearer if you regroup. > Try something like: > > if button1 > if buttonP2 > ... > elseif buttonP2 > ... > elseif ... > ... > end > elseif button2 > if buttonP2 > ... > elseif buttonP2 > ... > elseif ... > ... > end > elseif ... > ... > end > > The above avoids the "&&" and "== 1" tests. > (I assume the button values are "logoicals"  either 0 or 1.)
Oops, the above should be:
> if button1 > if buttonP1 > ... > elseif buttonP2 > ... > elseif ... > ... > end > elseif button2 > if buttonP1 > ... > elseif buttonP2 > ... > elseif ... > ... > end > elseif ... > ... > end



