Thursday, 1 November 2018

MATLAB - Start New Project, Save and Change Background Color of GUI Window

1. Type 'guide' in the command window to open up a new or already saved GUI Window:


2.  Choose to open a new Blank GUI Window:



3. Choose File => New to open a new MATLAB GUI Project:



Select Blank GUI and also provide project name under 'Save new figure as:'

4. This will open the GUI Grid Window wherein we can start building the project.

 


5. Now, lets get rid of default Gray color and set it to some other background color. Right Click anywhere on the GUI Grid and choose option 'Editor' to open up the Editor Code Window:



6. Scroll towards the end of the following function:


function varargout = yourprojectname_OutputFcn(hObject, eventdata, handles)

% Get default command line output from handles structure
varargout{1} = handles.output;

7. Type the following code here:

%Rashmi:: Set Background Color of the Grid Window
set(gcf,'color','green')


8. Run the program  using the "Run" option in the menu panel to see the background color change:


No comments:

Post a Comment

MATLAB - Clear all Axes on button press in Pushbutton

% --- Executes on button press in pushbutton function pushbutton_Callback(hObject, eventdata, handles) % hObject    handle to pushbutton (s...