Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 8 Data Structures arrays, matrices and strings (a) Given a 2D array, called A, of size n x m, write a MATLAB script


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

Step by Step Solution

3.43 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

ANSWER This solution has a full explanation full Matlab code comments with code EXPLANATION Before going to directly answer first lets see the approac... 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

Data Structures and Algorithm Analysis in Java

Authors: Mark A. Weiss

3rd edition

132576279, 978-0132576277

More Books

Students also viewed these Databases questions