I am new to matlab and I want to show my excel data as a table in axes in gui using GUIDE. I am reading the table from the excel sheet and trying to convert it into uitable and display it in axes. How can i do that?

1 view (last 30 days)
function Emergency_selection_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 Emergency_selection (see VARARGIN)
% Choose default command line output for Emergency_selection
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
%read the data from file
%[num,txt,raw]=xlsread('C:\Users\abhijit\Desktop\mmajor.xlsx');
%uitable1 =uitable(Emergency_selection,'Data',[num,txt,raw]);
t=readtable('C:\Users\abhijit\Desktop\mmajor.xlsx');
tab=uitable
tab=t;
%update the table
set(handles.tab,'data',num,'ColumnName',txt);
%update the plot
plot3(handles.axes1, num(:,1), num(:,2), num(:,3));
% UIWAIT makes Emergency_selection wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Emergency_selection_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)
% Get default command line output from handles structure
varargout{1} = handles.output;
  1 Comment
Geoff Hayes
Geoff Hayes on 28 May 2018
Abhijit - since you are using GUIDE, why don't you just create a uitable (there, in GUIDE) and then populate it in your code? Do you know how many colummns of data will be in the table? Do you know their data types?

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!