Question
In Matlab You are working at a hospital's IT department. The hospital is recruiting patients for clinical trial of a new drug. In the current
In Matlab
You are working at a hospital's IT department. The hospital is recruiting patients for clinical trial of a new drug. In the current phase of the clinical trial, only female patients between the ages of 30 (inclusive) to 40 (inclusive) are being recruited. Your boss wants you to filter out the database of volunteer patients and extract the names of those matching the criteria. Write a function filterpatients that takes as input the list of patients in the database as a struct array and returns the names of eligible patients as a cell array of strings. Assume that the gender is always given in lower case, either as 'f' or 'm'.
>> disp(filterpatients(struct( ... 'name', {'mary','john','anna','paul','elaina'}, ... 'gender',{'f', 'm', 'f', 'm', 'f'}, ... 'age' ,{25, 35, 30, 22, 38} ) )); 'anna' 'elaina' >> disp(filterpatients(struct( ... 'name', {'mary','john'}, ... 'gender',{'f', 'm'}, ... 'age' ,{37, 35} ) )); 'mary'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started