Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB Problem 1a: In this problem, you are going to create a function that takes 4 inputs and returns a structure. The function has the

MATLAB

Problem 1a:

In this problem, you are going to create a function that takes 4 inputs and returns a structure. The function has the format: Function structure = Construct ( brand, color, VIN, operational ) There are some requirements for this function:

1) If the number of inputs is not 4, display Error: Incorrect number of field values provided.

2) The input brand must be string, if not, display Error: brand must be string.

3) The input color must be string, if not, display Error: color must be string.

4) The input VIN is a mix of string and numbers. Its 6 digits in total. The first digit will be a character V, the others will be numbers. You can use isstrprop() function. Use isstrprop(array, alpha) or isstrprop(array,digit) to check the string. For example:

If the format is not correct, display Error: VIN format is not correct.

5) The input operational must be Boolean value, True or False. If not, display Error: operational must be Boolean.

6) When the structure is successfully created, display information recorded!

Problem 1b:

Use the function you have write to create an array of structure, which includes the following information:

Brand color VIN operational
Honda White V12345 true
BMW Black V23451 false
Buick Red V34512 false
Mazda Silver V45123 true
Audi Black V51234 true

For example, create a car structure with the construct function: car1 = construct(Honda, White, V12345, true). All the structure will be put into an array.

Problem 1c

Use for loop to filter all the cars whose operational is True and display their VIN.

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

LO2 Explain the major laws governing employee compensation.

Answered: 1 week ago