필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by