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
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