Wednesday, 7 November 2018

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 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 


%Clear all Loaded Axes
cla(handles.axes1,'reset')
cla(handles.axes2,'reset')
cla(handles.axes3,'reset')
cla(handles.axes4,'reset')







MATLAB - Load an Image onto Axes

% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%Load Image onto Axes


%Display only required file extensions in folder
[filename pathname] = uigetfile({'*.jpg';'*.png'},'Select Image');

%Concatenate the pathname and filename and store into a single variable
inputImage=strcat(pathname, filename);

%Load Image onto axes1

imshow(inputImage, 'Parent', handles.axes1);

MATLAB - Set text in TextBox on PushButton action

%Example - 1
% --- Executes on button press in pushbutton1
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Set text  in textbox1 on pushbutton1 action


set(handles.textbox1,'string','New Text here on clicking pushbutton1');



%Example - 2
% --- Executes on button press in pushbutton1
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%Set text  in textbox1 on pushbutton1 action - Convert number to string


intNum=5999; 
% var intNum need to be converted to  a string
strintNum = num2str(intNum);
set(handles.textbox1,'string',strintNum);
 
 
 


Friday, 2 November 2018

MATLAB - Change default background color of the GUI Grid Window


Scroll towards the end of the following function of the code:

function varargout = yourprojectname_OutputFcn(hObject, eventdata, handles)

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

Type the following code here:

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










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:


Wednesday, 31 October 2018

MATLAB - Step 1 - INSTALL MATLAB on WINDOWS

I installed the MATLAB 2018b on Windows for academic use as I am a student.

Installation steps:

1. Get all the required installation files (either from your education institution or download it from: https://in.mathworks.com/academia/student_version.html

2. Follow the instructions as provided by your system administrator to install MATLAB for refer the following link:

https://in.mathworks.com/help/install/ug/install-mathworks-software.html

3. That's it. MATLAB is ready for use.

4. Click on the MATLAB icon on Desktop or 'Start Menu' to open MATLAB.

5. This will by default open the 'Editor Window' as shown below:



6. Type 'guide' in the command window as shown above to open the GUI Window which will the main area of discussion in further posts.


 7. That's it!  You are ready to start the project.

MATLAB - Automated Blood Group Detection

This is my first hands-on on MATLAB. As part of M.tech (Semester 1) project, I chose to build an automated Blood Group Detection program using Image Processing Techniques.

As I build this project, will update details on learning MATLAB for new users as I am currently doing hoping it will help someone having similar queries as I do have now.

So, stay tuned!

Cheers
Rashmi

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...