Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Function Name: graveDigging MATLAB Inputs: 1. (cell) 1xN cell vector of zombie graves Outputs: 1. (double) The total strength of all zombies 2. (double) The
Function Name: graveDigging MATLAB Inputs: 1. (cell) 1xN cell vector of zombie graves Outputs: 1. (double) The total strength of all zombies 2. (double) The positions of immune bodies Background All of the graveyards have been infected with a Zombie Virus! Fortunately some of bodies are immune, but which ones? Luckily, the power of MATLAB can help you to assess a graveyard to determine the strength of the zombies and the location of the immune zombies. Function Description: You are given a 1xN cell array. Each element will be a nested cell of varying depths. Each position in the array will contain a scalar double which represents the strength of that zombie. Unnest the cells at each position, and output the sum of the all values of all the elements as the total strength. Then, find the element positions of all the zeros in the cell vector and return that as the second output. Example: >> graveyard = [{{{{4}}}}, {0}, {{1}}, {{{e}}}] [strength, immune] = graveDigging(graveyard) strength 5; immune [2, 41; Notes: Every cell will only contain either a 1x1 cell or a non-negative 1x1 double
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