How can I select automaticaly a header of excel sheet and read the header row with xlread?

조회 수: 13 (최근 30일)
hello,
i have an excel sheet with sensor measurment data . I use xlsread to read the data my question is how can i select the header name of the row and read the data. the header name is always the same but the coulmn number is different therefore i want to give the header name and the program should select the data and plot the result. Do you have idea? thanks in advance.

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 7일
We would suggest using readtable(), after which you can access the columns by name.
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 2월 9일
xlsx files store the data as text . Reading one column of them inherently requires reading all of the columns and throwing away the parts that you do not want . You might as well readtable and access the part you want out of the result .
xls files can be implemented more than one way, one of which is a binary file that might possibly be faster to read just one column . For that use xlsread or readtable and pass it an excel style range like A1:XFD1 . You can then search for your known header in what is returned .
Nahom Nigatu
Nahom Nigatu 2019년 2월 12일
thanks Walter, my problem is how i select the header name with right range i have still done this
data = xlsread(File,'Sheet1','A2:A100');
I can read from this sheet a specified range 'A2:A100' in range 'A1:A1' exist header name 'Test1' but header name Test1 is not always in the same range some times in range B or C . The header name is always the same but the range postion is not thats why i want to get first search the header first and read the apropriert range. Is there any oportunity to do this? I can select every time manually but i wannt to select the range automaticly. Thanks in advance!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by