Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Code 2: The text file bpdata.txt contains the follow systolic blood pressure, di

ID: 3706835 • Letter: C

Question

Code 2: The text file bpdata.txt contains the follow systolic blood pressure, diastolic blood pressure. Write a MATLAB script that calculates if each individual in the data set is "Ideal", "Pre-High", or "High" blood pressure classification. Classification is based on the following: ing information in each column: ID #, name, 1. Ideal: Systolic> 90 and 60 and 120 and 80 and 140 and Diastolic> 90 Save the classification and names with each classification to an Excel file called "BPResults". An example of what the Excel file data would look like is given below. 1 Ideal Pre-High 2 Bob Brad 3 Jane Thomas High Charollete Stan

Explanation / Answer

The Matlab code can be split into three major Parts:-

1. Reading Data from the text file

2. Check the Available Conditions and Store data into Variables

3. Save data to a text file.

The code is available in the public Pastebin link:-

https://pastebin.com/us4YxTzU

The Test Data Wasn't Provided hence I created it on my own.

Let me Walk you through the Code Step By Step:-

Line 1:- readtable() function is used to read the data from the bpdata.txt file.

Note: It Is assumed that the data is available in a comma-separated format.

Line 2 to 4:- This line is a bit tricky. T.Systolic>90 this expression checks all the rows of Systolic pressure and returns a binary value for each row. Similarly based on the provided conditions the statements of ideal, Pre-High and High were written. After getting a binary value for each row we select the names as T.Name(...).

Line 6 to 9:- The generated names were saved in a particular file using the file handling operators present in Matlab.

Note: Open Matlab Software with Administrative rights as writing to a file won't be allowed otherwise.

Thanks.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote