how to store or display some data from excel sheet in uitable created in GUI?

2 次查看(过去 30 天)
*I am unable to dump the contents of excel sheet into the uitable created in GUI.*I am using data from excel sheetes to write matlab programs. Also I have crating a GUI containing all the program codes. But i want to display the data in a uitable from the excel sheets and I am unable to do it. I have wriiten the following code
f = figure('Position', [200 200 400 150]);
dat= rand([10,3]);
cnames = {'Actual', 'Forecast', 'Error' };
rnames={'1','2','3','4','5','6','7','8','9','10'}
t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,'RowName',rnames,'Position',[20 20 360 100]);
From the above code table is created in a new figure with specified rows and columns. But the entries contains some redundant data and i havent provided any path to excel. i want to eliminate those redundant and provide a path to excel sheet so that the specified part of the cell come and fall into the uitable. How can I do this?

回答(1 个)

Iain
Iain 2013-6-11
[n,t, r] = xlsread(filename,sheet, range...);
substitute "r" for dat, uigetfile can be used to get the path and the filename of a file, the sheet can be specified, or left to user selectable, just look at the help for xlsread.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by