MATLAB In broad terms, the program will: ● Prompt the user to select an input directory ● Open and parse the all the files in that directory to obtain information on data to process ● Load additional...

MATLAB In broad terms, the program will: ● Prompt the user to select an input directory ● Open and parse the all the files in that directory to obtain information on data to process ● Load additional files containing data ● With these data files: ○ Compute values based on their contents ○ Write formatted output of the computed values ○ Create & save plots of the data You MUST use functions in this assignment. No scripts. The number of functions is up to you but even your top level code must be a function. In more specific terms, you are processing mechanical data from explanted human arteries. One treatment for heart failure is heart transplant. Some patients requiring transplant can survive until transplant without the need for mechanical assistance; others need a left ventricular assist device (LVAD) to "bridge to transplant". These LVAD patients have no pulse (an LVAD is constant flow), so the aorta is exposed to continuous, steady flow, rather than pulsatile flow. After transplant, clinicians noticed the LVAD patients had other issues, among them mechanically stiffer aortas. So, we tested small pieces of human aorta, explanted during open heart surgery, to test the hypothesis that steady flow over the aorta was causing it to stiffen. A little more detail on the testing. We get a single piece of tissue (explanted during surgery). It is sliced to the appropriate size, mounted on the testing system, and the test is initialized on the computer that controls the apparatus. This is a single "Sample" and the initialization creates a "Sample File". When testing the single piece of tissue, we want to make sure we capture its behavior from no load (and no deformation) all the way to max load at failure. So for our first pull, we start with a very small peak deformation (like 20% strain - a change from undeformed length, at 100%, to 120%). That first pull generates a "Specimen File". Then we increase the peak deformation to 25%, and run it again - another "Specimen File"... and so on, until we've collected enough data, or the piece of tissue breaks. The testing system (MTS) names the files this way, and I've kept the names, but they are a little confusing. The data is provided in the following way: ● "Sample File", that describes the test for a single sample. It looks like this: "Test Method:","precondition_tensile_extensiondep_n-cycles_disp.msm"


"Sample","Spcmn","Width","Thickness","Nominal Gage Length","belastin","Test to Prescribed Strain","long","Peak Load","Peak Stress","Strain At Break","Modulus" "I. D.","No.","mm","mm","mm","","","","N","kPa","%","kPa" "2013_10_3-A0974-Aorta.mss","1","13.80000","2.40000","3.560","0","1"," 0","6.015","181.6","-115.902","180.79950" "2013_10_3-A0974-Aorta.mss","2","13.80000","2.40000","8.870","0","1"," 0","7.443","224.7","-42.294","728.90432" "2013_10_3-A0974-Aorta.mss","3","13.80000","2.40000","6.620","0","1"," 0","6.009","181.4","-67.051","456.51479" ● "Specimen File", that describes a single pull of the sample. They look like this: "Test Method","precondition_tensile_extensiondep_n-cycles_disp.msm" "Sample I. D.","2013_10_3-A0974-Aorta.mss" "Specimen Number","1" "Time (s)","PrimaryExtension (mm)","Load (mN)","Stress (kPa)","Strain (%)" 0.110,-13.4785,-158.15413,-4.775,-378.610 0.120,-13.4784,-274.40938,-8.285,-378.607 0.130,-13.4770,-217.62963,-6.571,-378.567 0.140,-13.4743,-133.17571,-4.021,-378.492 0.150,-13.4713,-153.39831,-4.632,-378.407 [...] (data continues) Notice several things: ● Each file has headers, that have to be properly dealt with. ● The sample file has a line for each specimen file that was tested. So, this gives you your "to do" list (files that have to be processed).


● The sample file has three values "Width", "Thickness", and "Nominal Gage Length" that you need for processing the data in the specimen file. ● The sample file is all in quotes (ARRRRGH!), whereas the actual numbers you'll need in each specimen file are unquoted. ● The specimen file's "PrimaryExtension" and "Load" will be needed in your process. Now, going back to the "broad terms" above, let me add more detail to the process. ● Prompt the user to select an input directory... You'll need a MATLAB ui function that requests and returns a directory. ● Open and parse the all the files in that directory to obtain information on data to process... You'll need to be able to read a directory (it's a structure) ● Load additional files containing data... You'll need to parse the sample file to determine what additional specimen files need to be loaded, then load them. Note that not all the specimen files are there, so you need to be able to handle missing files without crashing. ● With these data files: ○ Compute values based on their contents (see equations below) ○ Write formatted output of the computed values... You'll need to create a new filename, similar to the specimen name, to write output to, and use fopen/fprintf/fclose to do the output. Output consists of strain, stress in columns. Make your filename the same as the specimen filename, but with _output appended to it. ○ Create & save plots of the data... You'll need to plot, label, and then print the plots to .PNG format images. The plot must have the specimen filename as its title, and the PNG file must have the same as the specimen filename, but with _plot appended to it. The actual computation is as follows. Let T0 = "Thickness" W0 = "Width" L0 = "Nominal Gage Length" d = "PrimaryExtension" P = "Load" Then you need to compute: strain = 100*d/L0


stress = 1000*P/(T*W) where T and W are given as T = T0/sqrt(1+strain/100) W = W0/sqrt(1+strain/100) The data is in this zip file Mech_Data.zip. Additionally (OPTIONAL), here are several papers published about the testing process and the actual first set of results of the human aorta study: First mechanical testing paper from our group, looking at calf (baby cow) arteries in health and pulmonary hypertension: AJP-HCP_V295I4_pH1451-H1459.pdf First paper on aortic stiffening in humans with implanted LVADs: CircHF_V8I5_p944-952.pdf A couple more clarifications: ● You can assume that the Data directory containing the specimen files is within the Mech_Data directory; you don't need to ask for a second directory. Ask for one directory, and assume that the files are laid out as they are as given (sample files in main directory, specimen files in subdirectory called "Data"). ● You can assume that if a sample file is named "Blah.txt", its specimen files will be named "Blah_1.txt", "Blah_2.txt" and so on. ● You can assume that sample files and specimen files have headers of a specific size and use these (constant) values to your advantage, given, for example, that the sample file contains the total (possible) specimen files that have to be processed. ● You can assume that the column placement of the data is consistent across the files, and use these positions to your advantage. You don't have to "search the headers" for the data you want. ● You CANNOT assume a specific number of sample files, or specimen files. That is, your code should be able to figure it out on its own what is there. If I were to give you, say, fifteen more datasets (sample file + accompanying specimen files), your code should be able to automatically detect them and process them. What to turn in: ● Your code


● A Command Window PDF printout of your code running ● Make your code spit out disp() statements saying (a little bit) of what it's doing: ○ Loading new sample file ○ Loading specimen files ○ Writing output and plot files ● I will suggest a few plots and outputs to upload. You do not need to interpret the filenames and say anything about the tests themselves.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here