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 次查看(过去 30 天)
  
       显示 更早的评论
    
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 个评论
  Geoff Hayes
      
      
 2018-5-28
				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?
回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!