フィルターのクリア

How can I delete a row in a excel dokument if the value in a colonm is = F???

1 回表示 (過去 30 日間)
Peter Johansen
Peter Johansen 2017 年 5 月 20 日
回答済み: MathReallyWorks 2017 年 5 月 22 日
I have an assignment In Matlab, and I am not a very experience user of it, so I would love if any1 og you could help me out.
this is part of my assignment and I only need help top the question D
I have two excel dokument one with Social Security numbers in column 1. and income in column 2. the other dokument I have SSN I column 1. and gender in colonm 2 (F or M) for the gender. I really hope some of you guys can help me out.

採用された回答

MathReallyWorks
MathReallyWorks 2017 年 5 月 22 日
Hello Peter Johansen,
Here you go. Use this code. It deletes all the F rows and the corresponding rows in income excel sheet too. It saves the final excel sheets as genderlistfinal.xls and incomelistfinal.xls in current folder. Check it out.
[num,txt,raw] = xlsread('gender.xls');
[num1,txt1,raw1] = xlsread('income.xls');
num1=num1(:,2); %income
j=1;
for i=1:10
if char(txt(i))=='M'
num2(j)=num1(i);
txt2(j)=txt(i);
j=j+1;
end
end
filename1 = 'genderlistfinal.xls';
xlswrite(filename1,txt2')
filename2 = 'incomelistfinal.xls';
xlswrite(filename2,num2')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by