Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Matlab Function Name: graphcmp Inputs: 1. (char) A MXN char array representing a bar graph 2. (char) A KxL char array representing a misformated

Use Matlabimage text in transcribedimage text in transcribed

Function Name: graphcmp Inputs: 1. (char) A MXN char array representing a bar graph 2. (char) A KxL char array representing a misformated bar graph Outputs: 1. (char) A formatted string describing the mistakes in the second graph Topics: (masking), (array operations) Background: You are a hardworking intern at CS1371 Corp and have compiled some performance data on different employees to help your boss decide who should get a raise at the end of the quarter. However, your boss can be a bit of a dunce and has messed up your nicely formatted graphs! You must now find the differences between the two graphs and inform your boss of how they messed up! Function Description: You are given two char arrays that represent bar graphs. The first array contains your correctly formatted bar graph. In your array, each EVEN column will represent a bar on your graph. The ODD columns contain only white space (' ') to help your graph be more visually appealing. Starting from the bottom of the array, the bars are made of an arbitrary character that is NOT a space (' '). The second array is messed up and may have any number of the following errors: (1) the bars themselves may consist of a different character, (2) the bar heights may be different, (3) the second array may have been reshaped so the array dimensions are incorrect and the graph is unreadable. You must determine how many bars in the second bar graph are incorrect. First, you should ensure your second array has the same dimensions as the first array. Second, you should compare the heights of each bar between the two graphs to count the number of bars that are different. Output the number of bars with incorrect heights in a string that follows the format: 'My boss' graph has bars that need fixed!' where numIncorrectBars is the number of bars in the second graph that are of a different height than the first graph. Example: myGraph = bossGraph ['$ ']; "]; str = graphcmp (myGraph, bossGraph); str + 'My boss' graph has 3 bars that need fixed!' . . Notes: The even columns of myGraph have been highlighted for visual clarity, this is not a part of the problem. Every column with an even index in the graph counts as a bar, even if that bar's value is zero. The first and last column of the graph will always contain only spaces. You are guaranteed to have at least 1 bar in every graph You will always have the same number of bars for both graphs A bar of correct height but incorrect character does not have to be fixed and is not to be counted in the output Hints: . The reshape () function may be useful Masking might help you figure out the size of each bar When including an apostrophe in a string, use" (2 apostrophes) to tell MATLAB that the apostrophe is not supposed to be the end of the string . Function Name: graphcmp Inputs: 1. (char) A MXN char array representing a bar graph 2. (char) A KxL char array representing a misformated bar graph Outputs: 1. (char) A formatted string describing the mistakes in the second graph Topics: (masking), (array operations) Background: You are a hardworking intern at CS1371 Corp and have compiled some performance data on different employees to help your boss decide who should get a raise at the end of the quarter. However, your boss can be a bit of a dunce and has messed up your nicely formatted graphs! You must now find the differences between the two graphs and inform your boss of how they messed up! Function Description: You are given two char arrays that represent bar graphs. The first array contains your correctly formatted bar graph. In your array, each EVEN column will represent a bar on your graph. The ODD columns contain only white space (' ') to help your graph be more visually appealing. Starting from the bottom of the array, the bars are made of an arbitrary character that is NOT a space (' '). The second array is messed up and may have any number of the following errors: (1) the bars themselves may consist of a different character, (2) the bar heights may be different, (3) the second array may have been reshaped so the array dimensions are incorrect and the graph is unreadable. You must determine how many bars in the second bar graph are incorrect. First, you should ensure your second array has the same dimensions as the first array. Second, you should compare the heights of each bar between the two graphs to count the number of bars that are different. Output the number of bars with incorrect heights in a string that follows the format: 'My boss' graph has bars that need fixed!' where numIncorrectBars is the number of bars in the second graph that are of a different height than the first graph. Example: myGraph = bossGraph ['$ ']; "]; str = graphcmp (myGraph, bossGraph); str + 'My boss' graph has 3 bars that need fixed!' . . Notes: The even columns of myGraph have been highlighted for visual clarity, this is not a part of the problem. Every column with an even index in the graph counts as a bar, even if that bar's value is zero. The first and last column of the graph will always contain only spaces. You are guaranteed to have at least 1 bar in every graph You will always have the same number of bars for both graphs A bar of correct height but incorrect character does not have to be fixed and is not to be counted in the output Hints: . The reshape () function may be useful Masking might help you figure out the size of each bar When including an apostrophe in a string, use" (2 apostrophes) to tell MATLAB that the apostrophe is not supposed to be the end of the string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

=+which it operates?

Answered: 1 week ago

Question

=+C&B (especially taxation) laws, regulations, and practices?

Answered: 1 week ago

Question

=+designing international assignment C&B packages.

Answered: 1 week ago