How to extract two columns from cell table based on two conditions
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aayma Mughal
el 1 de Ag. de 2022
Comentada: Aayma Mughal
el 4 de Ag. de 2022
Hello,
I have a data set that has sodium levels (numerical) in column 9 and blood pressure (logical) in column 6.
I want to create new table that has all sodium values <135 and all blood pressure values = 1.
When I use this, it returns the index.
measure_sodium = heart([heart{:,9}] < 135)
Same with this but with added blood pressure.
measure_sodium = heart([heart{:,9}] < 135 & [heart{:,6}] == 1 )
celldisp(measure_sodium) will individually print out the indices also not the actual values.
How can I return the actual values and not just the indices?
Thank you for your help.
1 comentario
Chunru
el 1 de Ag. de 2022
How do you organize your data? Array or cell? Attach a sample of your data.
Respuesta aceptada
David Hill
el 2 de Ag. de 2022
It is all number so I would convert to a matrix.
H=cell2mat(heart(:,[6,9]));
mesure_sodium=H(H(:,6)==1&H(:,9)<135,:);
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots 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!