Question: Matlab help: Function Name pumpkinPatch Inputs 1. struct MxN pumpkin patch array Outputs 1. (struct) Best pumpkin Background You are Linus van Pelt , Charlie

Matlab help:

Function Name pumpkinPatch

Inputs

1. struct MxN pumpkin patch array

Outputs

1. (struct) Best pumpkin

Background

You are Linus van Pelt , Charlie Brown's neighbor. As Halloween approaches, you need

to prepare for the arrival of the Great Pumpkin by finding the best pumpkin in the neighborhood

pumpkin patch! Since you don't want to be disappointed again by the Great Pumpkin, you need

to make sure you find the sp00kiest pumpkin in the pumpkin patch, so you turn to MATLAB to

help you out!

Function Description

You are given a MxN structure array, where each structure represents a pumpkin. The

pumpkins will have several fields with numerical values, along with one field that contains text.

Score each pumpkin by summing up all of the numerical values, and output the structure that

has the highest total score. If a pumpkin contains the string 'Great Pumpkin' in the field that

contains text, output that pumpkin instead.

Example

>> patch =

color: orange

size: 5

weight: 30

color: not orange

size: 10

weight: 35

color: orange

size: 50

weight: 28

>> out = pumpkinPatch(patch)

>> out

color: orange

size: 50

weight: 28

Notes

Only one pumpkin will ever be the Great Pumpkin, and there will only be one pumpkin

with the highest score.

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!