How to export excel file headers & its contents
Ältere Kommentare anzeigen
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
Antworten (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 Kommentare
hussain
am 23 Dez. 2013
ES
am 23 Dez. 2013
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
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!