Matlab Calculator GUI (Assignment)
Matlab Calculator GUI (Assignment)
Matlab Programming
BCA-V
Problem 1
Make a GUI based Calculator using Matlab. The calculator should perform the basic operations.
gui_Singleton = 1;
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
else
gui_mainfcn(gui_State, varargin{:});
end
handles.output = hObject;
guidata(hObject, handles);
varargout{1} = handles.output;
old=get(handles.text3,'string');
new=('7');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('8');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('9');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('4');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('5');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('6');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('1');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('2');
new1=strcat(old,new);
set(handles.text3,'string',new1);
new=('3');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new=('*');
new1=strcat(old,new);
set(handles.text3,'string',new1)
old=get(handles.text3,'string');
new=('-');
new1=strcat(old,new);
set(handles.text3,'string',new1)
old=get(handles.text3,'string');
new=('+');
new1=strcat(old,new);
set(handles.text3,'string',new1)
old=get(handles.text3,'string');
set(handles.text2,'string',new);
set(handles.text3,'string', '');
old=get(handles.text3,'string');
new=('.');
new1=strcat(old,new);
set(handles.text3,'string',new1);
function pushbutton0_Callback(hObject, eventdata, handles)
old=get(handles.text3,'string');
new=('0');
new1=strcat(old,new);
set(handles.text3,'string',new1);
old=get(handles.text3,'string');
new= char();
new(i)=old(i);
end
set(handles.text3,'string',new);
old=get(handles.text3,'string');
new=('/');
new1=strcat(old,new);
set(handles.text3,'string',new1);
set(hObject,'BackgroundColor','white');
end
set(hObject,'BackgroundColor','white');
end
set(hObject,'BackgroundColor','white');
end
old=get(handles.text2,'string');
new= char();
new(i)=old(i);
end
set(handles.text2,'string',new);
Problem 2
Create a GUI interface using Matlab for “String Processing”. The interface should do the following
functions-
gui_Singleton = 1;
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
handles.output = hObject;
guidata(hObject, handles);
varargout{1} = handles.output;
old=get(handles.text1,'string');
newStr = upper(old)
set(handles.textout,'string',newStr);
old=get(handles.text1,'string');
new=get(handles.text2,'string');
set(handles.textout,'string',str3);
old=get(handles.text1,'string');
t = table(old)
oldString = t.myStrings{row};
t.old{row} = oldString(1:end-1);
end
set(handles.textout,'string',t);
old=get(handles.text1,'string');
set(hObject,'BackgroundColor','white');
end
set(hObject,'BackgroundColor','white');
end
set(hObject,'BackgroundColor','white');
end
old=get(handles.text1,'string');
newStr = lower(old)
set(handles.textout,'string',newStr);