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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started