Question 8 Data Structures arrays, matrices and strings (a) Given a 2D array, called A, of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 8 Data Structures arrays, matrices and strings (a) Given a 2D array, called A, of size n x m, write a MATLAB script that will store all of the odd values in the 'fence' of A in a new vector. MATLAB matrix shortcuts can not be used for this problem (ie A(x,:) can not be used to get an entire row) (note: the 'fence' is the outer rows and columns) Sample Output: Given A [ 5, 4, 6, 7, 3 1, 2, 3, 4, 5 ; 5, 6, 4, 2, 4; 4, 5, 3, 2, 1 [5 7 3 1555 3 1] Fence of the above matrix is 5 4 6 7 3 1 5 5 4 4 5 3 2 1 [14 marks] (b) Write a MATLAB script that reads in a string and a character from the user and prints out the number of times the character appears in the string Question 8 Data Structures arrays, matrices and strings (a) Given a 2D array, called A, of size n x m, write a MATLAB script that will store all of the odd values in the 'fence' of A in a new vector. MATLAB matrix shortcuts can not be used for this problem (ie A(x,:) can not be used to get an entire row) (note: the 'fence' is the outer rows and columns) Sample Output: Given A [ 5, 4, 6, 7, 3 1, 2, 3, 4, 5 ; 5, 6, 4, 2, 4; 4, 5, 3, 2, 1 [5 7 3 1555 3 1] Fence of the above matrix is 5 4 6 7 3 1 5 5 4 4 5 3 2 1 [14 marks] (b) Write a MATLAB script that reads in a string and a character from the user and prints out the number of times the character appears in the string
Expert Answer:
Answer rating: 100% (QA)
ANSWER This solution has a full explanation full Matlab code comments with code EXPLANATION Before going to directly answer first lets see the approac... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these databases questions
-
The NPV model should not be used for investment decisions about advanced technology, such as computer-integrated manufacturing systems. Do you agree? Explain.
-
PLEASE ANSWER USING EXCEL FORMAT POSTED BELOW a) Determine the market value of debt b) Determine the market value of equity c) Determine the market value of preferred stock c) Determine the total...
-
A 2D Array consists of four rows and six columns. Each row represents a student while each column represents a lab grade. Write the following functions and test them: ¢ Print the average grade...
-
Calculate the following ratios for both 2021 and 2020 years: current ratio, quick ratio, debt to equity ratio, debt ratio, gross profit ratio, net profit ratio, return on equity, return on total...
-
Consider an ONLINE_AUCTION database system in which members (buyers and sellers) participate in the sale of items. The data requirements for this system are summarized as follows: The online site...
-
An electronics company manufactures resistors that have a mean resistance of 100 ohms and a standard deviation of 10 ohms. The distribution of resistance is normal. Find the probability that a random...
-
On January 2, 2018, The Register, a science and technology news site based in Britain, published an article revealing the existence of two major bugs leaving virtually all computers and smartphones...
-
Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe, NM 87501. Lance works for the convention bureau of the local Chamber of Commerce, while Wanda is employed part-time as a...
-
A co-worker makes a joke with you about a client, saying they 'dress up' on the days you are on shift. The next week you receive a friend request on a social networking site from that client - do you...
-
You are a staff accountant preparing your first Form 1120 for your first client, SageGreen Computer Corporation. Your manager plans to review your prepared tax form each step of the way, starting...
-
Before submitting the term paper, students will be guided through step by step by presenting each component part separately for evaluation by the professor as follows: The Industry name and its...
-
What issues do you think is relevant to technical communication that would be mostly online?
-
Which term is used to refer to signals that encourage effective communication? What are the 3 basic concepts of therapeutic communication?
-
Describe the elements of oral communication using a sender-receiver process. What can impair communication?
-
Produce a 60-minute ESL lesson plan on any language skills based on the CEFR KSSM. Provide activity each for Pre-lesson, While-lesson and Post lesson stage. Indicate the underlying Second Language...
-
The stock is currently selling for $15.25 per share, and its noncallable $1,000 par value, 20-year, 7.25% bonds with semiannual payments are selling for $875.00. The beta is 1.25, the yield on a...
-
ASAP PLEASE: Electoral Process Management System (EPMS) We want to design a data management application on the electoral process. We assumed that the data covers only one election. All eligible...
-
What are the four types of poultry production systems? Explain each type.
-
A complete binary tree of N elements uses array positions 1 to N. Suppose we try to use an array representation of a binary tree that is not complete. Determine how large the array must be for the...
-
Prove that any comparison-based sorting algorithm requires (N logN) comparisons on average.
-
The one-dimensional circle packing problem is as follows: You have N circles of radii r1, r2, . . . , rN. These circles are packed in a box such that each circle is tangent to the bottom of the box...
-
Personalized medicine may be used a. to characterize types of tumors. b. to predict the outcome of certain types of cancers. c. to determine the proper dosage of drugs. d. in all of the above.
-
Tumor-suppressor genes promote cancer when a. they are overexpressed. b. they are expressed in the wrong cell type. c. their function is inactivated. d. they are expressed at the wrong stage of...
-
A mutant gene that promotes cancer when it is overexpressed is called a. a tumor-suppressor gene. b. an oncogene. c. both a and b. d. neither a nor b.
Study smarter with the SolutionInn App