How to extract two columns from cell table based on two conditions

3 views (last 30 days)
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 Comment
Chunru on 1 Aug 2022
How do you organize your data? Array or cell? Attach a sample of your data.

Sign in to comment.

Accepted Answer

David Hill
David Hill on 2 Aug 2022
It is all number so I would convert to a matrix.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!

Translated by