how to extract data with some condition
37 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Samaneh Arzpeima
el 30 de Nov. de 2018
Comentada: Samaneh Arzpeima
el 30 de Nov. de 2018
Hello everyone
I have a 9 colomns of data,say x1 to x9, each colomn has 150 rows
I need to extract all the data when x2==0 and x1=0.5, and make a new dataset of 9 colomns
Please teach me how to do this
I will appreciate you help
3 comentarios
Respuesta aceptada
Mark Sherstan
el 30 de Nov. de 2018
Try the code below. You will have to change it to your data but you should get the idea.
% Generate a random matrix of intergers between 1 and 3
x = randi(3,[250 9]);
% Find where there are 1's in column one and 3's in column two for each row
row = find( x(:,1)==2 & x(:,2)==3 );
% Build a new matrix A that satisfies the condition of 1's and 3's
A = x(row,:)
Más respuestas (0)
Ver también
Categorías
Más información sobre Weather and Atmospheric Science 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!