Clear Filters
Clear Filters

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

2 views (last 30 days)
*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?

Answers (1)

Iain
Iain on 11 Jun 2013
[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.

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!