compare and calculate two excel sheet

조회 수: 1 (최근 30일)
Huitian Mao
Huitian Mao 2017년 5월 21일
댓글: akshatha nayak 2019년 3월 25일
I have two excel sheet, one contains the social security no. and gender, the other one contains social security no. and each person's income, now I have to calculate the average income for each gender. I understand that I need to use the total income of each gender to divide the total number of them, as they are in two excel sheet, I m lost. Any one can help? thank you so much
  댓글 수: 1
MathReallyWorks
MathReallyWorks 2017년 5월 21일
Hello Huitian Mao,
Please attach some similar excel sheet if you don't want to disclose the original one. It will be easy for us to solve your problem efficiently.

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

채택된 답변

MathReallyWorks
MathReallyWorks 2017년 5월 21일
Hello Huitian Mao,
I hope this will be helpful. I've attached a sample excel sheet of gender and income too. Change the location of excel sheets and run the code. It works as per your requirement.
%Assumptions:
%Both excel sheets have same number of rows
%1st coloum is social serial number and 2nd coloum is gender or income in
%both the sheets
clc;
[num,txt,raw] = xlsread('C:\Rahul\gender.xls');
[num1,txt1,raw1] = xlsread('C:\Rahul\income.xls');
num1=num1(:,2); %income
MaleIncome=0;
NumberOfMales=0;
MaleAvgIncome=0;
FemaleIncome=0;
NumberOfFemales=0;
FemaleAvgIncome=0;
for i=1:10
if char(txt(i))=='M'
MaleIncome=MaleIncome+num1(i);
NumberOfMales=NumberOfMales+1;
elseif char(txt(i))=='F'
FemaleIncome=FemaleIncome+num1(i);
NumberOfFemales=NumberOfFemales+1;
end
end
MaleAvgIncome=MaleIncome/NumberOfMales;
disp('Male average income : ')
disp(MaleAvgIncome);
FemaleAvgIncome=FemaleIncome/NumberOfFemales;
disp('Female average income : ')
disp(FemaleAvgIncome);

추가 답변 (1개)

akshatha nayak
akshatha nayak 2019년 3월 25일
See mine filename is testdata1.xls it has 2 sheet 1st sheet has id name and branch I will enter id in gui and then i need to check whether that id is present in 1st sheet If it is present then store that id value along with current time in 2nd sheet
  댓글 수: 1
akshatha nayak
akshatha nayak 2019년 3월 25일
I am doing eye recognition based attendance system project But i have a problem in capture and storing image and compare that inage with other images Can any 1 help me to solve this problem

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

카테고리

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