Function to read find title of an excel column
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael
el 18 de Jun. de 2011
Respondida: Ahmed Elsherif
el 22 de Nov. de 2018
I'm looking for a way to identify a specific column in an excel document based on the header of the column.
I have documents with a bunch of columns of data with different titles in different orders. I want to pick out the column with a specific title and make a matrix out of the data in that column. (I can't just use the number of the column because the order varies depending on the document)
Do you know any function that can help with that?
Thanks!
0 comentarios
Respuesta aceptada
Oleg Komarov
el 18 de Jun. de 2011
Import the excel sheet:
[data, text] = xlsread(...);
Now, use:
idx = strcmpi(text(1,:),'HeaderIamLookingFor')
data(:,idx)
0 comentarios
Más respuestas (1)
Ahmed Elsherif
el 22 de Nov. de 2018
Hi,
I tried this but I got a wrong value. I typed a certain header name but I got the value under a different header!
Would you please tell me why this happens?
With the code below, I got the value under another header ('Start ch.')
Thanks in advance
handles.fileName = uigetfile ('.xlsx')
[data, text] = xlsread('LT2MELT');
r = strcmpi(text(1,:),'Zero_Chann.')
k=data(:,r);
set(handles.edit40,'string', k);
0 comentarios
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!