Question: I need help within 2 hours. Thanks. Homework 9 - High Level IO Function Name: calcium Inputs 1. (char) The name of a text file

I need help within 2 hours. Thanks. I need help within 2 hours. Thanks. Homework 9 - High Level

Homework 9 - High Level IO Function Name: calcium Inputs 1. (char) The name of a text file to read Outputs 1. (cell) A 2xN cell array describing the atoms appearing in the file Background Calcium is used in making porcelain and glass, in puritying sugar, in medicines, and in much more. You work in procurement at a chemical manufacturing plant. The manufacturing technicians send you a weekly list of all the compounds they need to make, and you use this information to decide how much of each pure element to buy that week. Obviously, you use MATLAB to complete such a task. Function Description Write a function that reads a text file full of chemical formulas and creates a cell array from the information in the text file. The first row of the cell array should contain all the atoms that appear in the text file (one atom per cell), and the second row should contain the number of times that atom appeared. Your output should contain all the atoms sorted in alphabetical er Example formulas.txt- CaCO3 CaC12 CaOHOH CaO C12H22Ca014 atoms-calcium 'formulas.txt') atoms -> 'C C1 2 13 24 20) Notes Atoms will always be represented as their chemical symbols, which will always contain either one or two letters. All chemical symbols begin with a capital letter and end with a lowercase letter if a second letter is present. Each line in the text file will contain only letters and numbers with no spaces or special characters. Hints . You may find the strcmp() function useful in determining whether a particular atom should be added to the cell array If you encounter an atom that is already in the cell array, simply update the count for that atom Consider making a helper function to update your cell array Homework 9 - High Level IO Function Name: calcium Inputs 1. (char) The name of a text file to read Outputs 1. (cell) A 2xN cell array describing the atoms appearing in the file Background Calcium is used in making porcelain and glass, in puritying sugar, in medicines, and in much more. You work in procurement at a chemical manufacturing plant. The manufacturing technicians send you a weekly list of all the compounds they need to make, and you use this information to decide how much of each pure element to buy that week. Obviously, you use MATLAB to complete such a task. Function Description Write a function that reads a text file full of chemical formulas and creates a cell array from the information in the text file. The first row of the cell array should contain all the atoms that appear in the text file (one atom per cell), and the second row should contain the number of times that atom appeared. Your output should contain all the atoms sorted in alphabetical er Example formulas.txt- CaCO3 CaC12 CaOHOH CaO C12H22Ca014 atoms-calcium 'formulas.txt') atoms -> 'C C1 2 13 24 20) Notes Atoms will always be represented as their chemical symbols, which will always contain either one or two letters. All chemical symbols begin with a capital letter and end with a lowercase letter if a second letter is present. Each line in the text file will contain only letters and numbers with no spaces or special characters. Hints . You may find the strcmp() function useful in determining whether a particular atom should be added to the cell array If you encounter an atom that is already in the cell array, simply update the count for that atom Consider making a helper function to update your cell array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!