get data from excel file

I have two excel file. The first one is the main excel file that has two columns: one with all workers names and second column with their job. The second excel files has one column with some worker that has won a prize. I want a code that look at the main excel file and write a second column that has the jobs for those worker that won a price.
Note: if it is hard wo deal with xls file, I can move the information to txt file and work with txt file

2 件のコメント

Namo
Namo 2011 年 3 月 3 日
worker name has diffrent length and contain different number of word (not just first and last name)
Namo
Namo 2011 年 3 月 3 日
xlsread create cell data. How can we search for item in cell array?

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 3 月 3 日

0 投票

See xlsread(), xlswrite() . With xlswrite() you can specify a particular cell range to write the data in to.
Matt Tearle
Matt Tearle 2011 年 3 月 3 日

0 投票

  1. xlsread to read both files into cell arrays.
  2. Use set operations (like, say, intersect) to find the names that are common to both.
  3. Use the corresponding indices to extract the jobs.
  4. Then use xlswrite to write the results.
Example of using intersect for this:
>> [names,idx] = intersect({'bob','sally','fred'},{'fred','sally'})
names =
'fred' 'sally'
idx =
3 2

質問済み:

2011 年 3 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by