-6
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');

What does this code mean It is used for GUI on Matlab

1 Answer 1

5

This is very difficult with so little context but I think I have some clue:

we start with a two part if: ispc is a built in function which does it's name, it returns whether or not the computer is a PC. false on linux/mac OSx and true on PC's.

The next part uses isequal to compare two values. The first: get(hObject,'BackgroundColor') will get the background color of wherever the handle hObject points. The second part, gets the default background color, which from here says "The default color is determined by system settings"

So this code means: For the figure with handle hObject, if we are on a pc AND our background color is the default background color, change it to white.

Not the answer you're looking for? Browse other questions tagged or ask your own question.