picking data from excel

조회 수: 2 (최근 30일)
Purushottama Rao
Purushottama Rao 2015년 5월 6일
댓글: Purushottama Rao 2015년 5월 7일
Hi I have an excel sheet which contains the names of the people (strings)as the first coulmn. Remaining coloumns contains the information (numeric data) such as height,age etc..
I would like to pick up the data corresponding to the given name and display it. Pls help me.

채택된 답변

Nobel Mondal
Nobel Mondal 2015년 5월 6일
matlab provides an extensive documentation on xlsread. Please try and see if this helps
doc xlsread
  댓글 수: 3
Nobel Mondal
Nobel Mondal 2015년 5월 6일
편집: Nobel Mondal 2015년 5월 6일
This is a rough outline. You may refer the documentation for finding specific refinement for your use case (like, sheet names, cell ranges etc)
1.
[~,~,rawdata] = xlsread('myspreadsheet.xlsx'); % Get everything in a cell-array
myRow = find(strcmp(rawdata, my_match_string));
myRowInfo = rawdata(myRow, 2:end);
You would get all the numeric values in that row in a cell array.
2. Assuming, your first row is reserved for the column names (and first column for the people-name), your numeric data should be in a (totalrows-1, totalcolumns-1) block in the spreadsheet. In this case, the following code should give you a numeric array.
[numdata, txtdata, ~] = xlsread('myspreadsheet.xlsx'); % get numbers and strings separately
myRow = find(strcmp(txtdata, my_match_string));
myRowInfo = numdata(myRow-1, :);
Purushottama Rao
Purushottama Rao 2015년 5월 7일
Thanks a lot. That gave me good info

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by