How to extract user defined data from excel sheet?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello All, I need help in extracting specific data from excel files. The example file screenshot is attached:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154080/image.png)
Now what I want is, to extract data for Data Point 121 for Para2, Para4, Para7
The issue is, I have many excel sheets to process and the don't have fixed column. Meaning, some files have Data point column at "C", Para1 maybe at "H", etc. Only headers "Data Point", "Para1",...."Para10" have same names.
I hope you are getting my problem. Please advice me on extracting such specific data based on the headers, not the column range.
댓글 수: 2
cbrysch
2016년 6월 17일
If I get your question right you want to extract a data point under e.g. Para6 and 8, but the column number is not always the same for different excel data sets? One way to get your data would be to find the column number you are interested in using strcmp() in an loop to check if you are in the correct column. Hope this helps
채택된 답변
Shameer Parmar
2016년 6월 17일
Hello Ali,
Please find attached code and input data sheet.
Keep it in matlab current directory and run the sheet.m file
It will ask you to enter the Data Point number and Para number, just enter the number and you will get the corresponding data as output..
Example:
Please enter the Data Point number = 121
Please enter Para number = 6
output =
87
read the code and modified as per your requirement.. Let me know if you stuck anywhere..
추가 답변 (1개)
Image Analyst
2016년 6월 17일
You're going to have to read in the whole workbook with xlsread() and then use strfind() or strcmpi() to examine the column headers to figure out what column(s) you need.
댓글 수: 2
Image Analyst
2016년 6월 17일
Looks like you've already accepted an answer without demo code to do that.
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!