How to export excel file headers & its contents

Hi Team
I have created POP-UP in Matlab GUI where it reads& Displays list of headers which are in Excel file, Next, How do i can read the entire contents(columns) of Selected Header in GUI ?
Can any Please help

回答 (1 件)

ES
ES 2013 年 12 月 23 日
編集済み: ES 2013 年 12 月 23 日

0 投票

using the column Number, read the contents using xlsread
columnB = xlsread(filename,'B:B')
and display it in either a edit box or in an uitable using set
set(handles.uitable1,'data',columnB );
or
set(handles.edit1,'string',columnB );

2 件のコメント

hussain
hussain 2013 年 12 月 23 日
I dont want to define column number, Based on appropriate Header selection its contents should be loaded
ES
ES 2013 年 12 月 23 日
You need not define the column number. Based on selection you can do it.
ColumnValue=get(handles.popup1,'value');
ColumnChar=getExcelColChar(ColumnValue);
columnData = xlsread(filename,['''',ColumnChar,':',ColumnChar,''''])
where getExcelColChar could be something like this...
function character=getExcelColChar(number)
% This Module gives the Column String of Excel Column for the corresponding
% Column Number. For eg, Excel Column 1 is A, Column 27 is AA, Column 256
% is IV.
if (number<=26)
Temp=uint8('A')+number-1;
character=char(Temp);
else
Temp=uint8('A');
number=number-26;
while(number>26)
Temp=Temp+1;
number=number-26;
end
character=[char(Temp) char(number+64)];
end

サインインしてコメントする。

質問済み:

2013 年 12 月 23 日

コメント済み:

ES
2013 年 12 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by