Hey together,
For a 1024 LED-Matrix I wanted to create a GUI where u can swith every single pixel on and off with a certain brightness. I wanted to create toggle Buttons which switch the Pixel on/off. So I started creating a 1024 huge buttonmatrix in GUIDE with copy/pasting as much buttons as possible. Afterwards to make sure Pixel 1 really represent Pixel 1 I renamed all Buttons accrouding to their Pixelnumber. EDIT : The Tag goes like T#### , for example for Pixel 1020 T1020 and for Pixel 66 T66.
For the callback I wrote the following Method to just copy/paste in every callback :
global TDatabrtn = get(handles.slider1, 'Value');Tag = get(hObject, 'Tag');PPos = 0;Si = size(Tag);for i = 2:Si(2) PPos = PPos*10 + str2num(Tag(i));endif(brtn < 0.3) brt = 0.3;else brt = brtn;endif(get(hObject,'Value') == 1) set(hObject,'BackgroundColor',[1*brt 1*brt 0]); TData(PPos) = 256 * brtn;elseif (get(hObject,'Value') == 0) set(hObject,'BackgroundColor',[0.149 0.149 0.149]); TData(PPos) = 0;end
So my question is it somehow possible to make this "smarter" with a Buttongroup etc. or do I really just have to copy/paste this 1024 times again?
Thanks for your answers!
Best Answer