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개)
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
2013년 12월 23일
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
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!