Question

With Matlab Please Transplant data The data file “transplants.txt” contains the # of transplants performed each...

With Matlab Please

Transplant data

The data file “transplants.txt” contains the # of transplants performed each year by different states in the country. Here’s the first few lines of the file:

0, 2015,2014,2013,2012,2011,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000

1,40,401,413,372,422,433,411,428,476,493,493,403,492,454,464,5272,109,711,754,652,735,618,590,601,607,511,498,421,354,376,341,2893,20,123,156,161,155,159,173,158,171,183,185,154,119,122,103,110

.

.

.

Each row is a different state, and each column (starting at column 2)is a different year; the first column is the state #, and the states are always listed 1, 2, 3, ... .

The first row of the file is a header row denoting the year; you may assume the years are consecutive, in descending order (e.g. 2015, 2014, 2013, ...).But the first year

can change —do not assume that column 2 is always 2015.

Likewise, do not assume that there are exactly 17 columns. Solve each of exercises below for the general case —the file could change to include more or less rows, and more or less columns. The only fair assumptions are (a)the states (rows) are listed

consecutively starting at 1, and (b) the years (columns) are listed consecutively in descending order .A sample input file is being made available so you can test your work if you wish:

transplants.csv:

https://www.dropbox.com/s/setu6ykcja2hwfx/transplants.csv?dl=0

This file can be found on the course web page under “Exams”, then “exam03

-files”; it contain only numeric data, so you can use the load( ) function to programmatically load the data.

Questions:

1.Column 2 contains the most recent year of transplant data. Recall that the first row is really a header row, and the actual data starts in the second row. Extract the year into a variable Y and extract the transplant data for that year into a variable T; keep in mind the # of rows can change from one file to the next. This should take just 2 lines of MATLAB code, no loops.

Example: given the data you see above, Y would be the value 2015, and T would be a column vector containing

40

109

20

.

.

.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

AFload (transplants.txt) Y A (1,2) T-A (2:end, 2) % loading the file into MATLAB % Extracting the most recent year into Y %

Add a comment
Know the answer?
Add Answer to:
With Matlab Please Transplant data The data file “transplants.txt” contains the # of transplants performed each...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is...

    problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is resolved in crank angle degree and is taken every 1/2 degree. O tittps/ualearn blackboard.com/bbcswebdav/pid plot a new function on the same graph overwriting the orizinal function 1 of11ρ Functions to choose from: y A sin(Bx C)+ D y A sin2(Bx+ C) + D y A In(Bx + C)D y A exp(Bx + C)+ D ž. The file "Test Data.xlsx" contains in-cylinder pressure data from...

  • Can this be solved in MATLAB language? CSCI 251 Lab 6 File I/O Due Data: Nov...

    Can this be solved in MATLAB language? CSCI 251 Lab 6 File I/O Due Data: Nov 22, 2019 Problem Statement Given a text file with experiment data, implement a program that performs following operations: 1) Reads data from a text file. 2) Extract numerical data. 3) Sorts the data in a descending order (max to min). 4) Save the sorted result to a new text file. Algorithms: 1. Use the input_data.txt file as the input for your program. It can...

  • The picture is given in a PPM file and your program should put the converted one...

    The picture is given in a PPM file and your program should put the converted one into another PPM file. •Use argv[1] for the given file and argv[2] for the converted file.In addition, you can use a temporary file called tmp.ppm. •The number of rows and columns are not fixed numbers. •The converted file should also follow the PPM format with the above simplification, and can be converted subsequently. •Read the pixel matrix into a buffer. •For each row i(...

  • There is a file called mat2.txt in our files area under the Assignments folder. Download it...

    There is a file called mat2.txt in our files area under the Assignments folder. Download it and save it in the same folder where this Matlab file (HW08_02.m) is saved. It may be worth opening that text file to see how it is set out. Note well, however, that the file might have a different number of lines and different number of numbers on each line. Write a Matlab program that does the following: Prompt the user for an input...

  • Using Rstudio please provide your code as well as a screenshot of your code ## File:...

    Using Rstudio please provide your code as well as a screenshot of your code ## File: lab5 ## Author: A. Breitzman ## Description: Manipulating and summarizing a data set ## ------------------------------------------------------------------------ ## Instructions: This worksheet is worth 5 points ## Exercises are worth 2.5 point each. If you cannot get the code to work in the line limits specified, the maximum that you can earn per exercise would be 1.5 points. ## First we need to load a library library(MASS)...

  • Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in...

    Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in a file. Your program should prompt the user for the name of the file to use and then request values be entered until the user is done. This data should be written to two files: a text file, user_file_name.txt and a comma separated value file, user_file_name.csv. To help you with decision making, we suggest that you ask the user to input data representing students’...

  • (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table()...

    (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table() function. Check the first five rows. (b) Create a new dataframe called tips by randomly sampling 6 records from the dataframe tips_df. Refer to the sample() function documentation. (c) Add a new column to tips called idx as a list ['one', 'two', 'three', 'four', 'five', 'six'] and then later assign it as the index of tips dataframe. Display the dataframe. (d) Create a new...

  • You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms. 1. Th...

    You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms. 1. The data in the following table are to be read from the file "grades.txt"and processed The grades are in percentages. The format of the data is shown below First Name ID Number Last Name Grades 001AA Tam 78.50 oe 86.45 001AB Gabriel Stuart Thus, there are 4 columns...

  • 1. Create a file that contains 3 rows of data of the form: First Name Middle...

    1. Create a file that contains 3 rows of data of the form: First Name Middle Name Last Name Month Day Year Month Day Year GPA. This file represents student data consisting of first name, middle name, last name, registration month, registration day, registration year, birth month, birth day, birth year, current gpa. ...or you may download the data file inPut.txt. inPut.txt reads:​​​​​​​ Tsia Brian Smith 9 1 2013 2 27 1994 4.0 Harper Willis Smith 9 2 2013 9...

  • python, please!!! comma separated values to store the data. The hame_count.csv file has one header row,...

    python, please!!! comma separated values to store the data. The hame_count.csv file has one header row, of the form: name, count Each successive row then has a name and a count for how many times that name appears in a database of names that the lab made up. For this first part of the lab, you must calculate the average name count. The steps to do so are as follows: Open the file, name_count.csv • Read all the lines from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT