Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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.

Respuesta aceptada

MathReallyWorks
MathReallyWorks el 22 de Mayo de 2017
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')

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by