Code covered by the BSD License  

Highlights from
CREATE TABLE AND SAVE DATA

image thumbnail

CREATE TABLE AND SAVE DATA

by

 

PASS ENTRIES IN TABLE AND SAVE AS MAT FILE

ABCD(varargin)
function varargout = ABCD(varargin)
% ABCD MATLAB code for ABCD.fig
%      ABCD, by itself, creates a new ABCD or raises the existing
%      singleton*.
%
%      H = ABCD returns the handle to a new ABCD or the handle to
%      the existing singleton*.
%
%      ABCD('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ABCD.M with the given input arguments.
%
%      ABCD('Property','Value',...) creates a new ABCD or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before ABCD_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to ABCD_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help ABCD

% Last Modified by GUIDE v2.5 12-Sep-2013 05:29:56

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ABCD_OpeningFcn, ...
                   'gui_OutputFcn',  @ABCD_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    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
% End initialization code - DO NOT EDIT


% --- Executes just before ABCD is made visible.
function ABCD_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to ABCD (see VARARGIN)

% Choose default command line output for ABCD
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes ABCD wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = ABCD_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global r 
r = 0;
clc
% Get default command line output from handles structure
varargout{1} = handles.output;



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global r
%persistent z
%z = cell(1,1:3);
a =  get(handles.edit1,'string');
b =  get(handles.edit2,'string');
c =  get(handles.edit3,'string');
if isempty(a) || isempty(b) || isempty(c)
    msgbox('FIRST FILL ALL THE ENTRIES....!!!','WARNING....!!!','warn','modal')
    set([handles.edit1  handles.edit2  handles.edit3 ],'string','')
    return
end
c = str2double(c);
c = int8(c);
if isnan(c) || c > 4 || c < 1
     msgbox('WRONG ENTRIES....!!!','WARNING....!!!','warn','modal')
    set([handles.edit1  handles.edit2  handles.edit3 ],'string','')
    return
end
set(hObject,'string',r)
r = r+1;
z = get(handles.uitable1,'Data');
z(r,1:3) = {a b c};
set(handles.uitable1,'Data',z)
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
n = cellstr(inputdlg('ENTER THE NAME OF VARIABLE.....!!!','SET'));
if isempty(n)
    return
end
var  =  get(handles.uitable1,'Data');
save('DATABASE1.mat','var')


% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set([handles.edit1, handles.edit2,handles.edit3],'string','')
set(handles.pushbutton2,'string','0')

Contact us