compare and calculate two excel sheet
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Huitian Mao
le 21 Mai 2017
Commenté : akshatha nayak
le 25 Mar 2019
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 commentaire
MathReallyWorks
le 21 Mai 2017
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.
Réponse acceptée
MathReallyWorks
le 21 Mai 2017
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);
0 commentaires
Plus de réponses (1)
akshatha nayak
le 25 Mar 2019
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 commentaire
akshatha nayak
le 25 Mar 2019
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
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!