Question: USE MATLAB TO SOLVE, NO HARD CODING Function Name: piCrust Inputs: 1. (cell) Your pie (a cell array), with kind words from Mary Berry hidden
USE MATLAB TO SOLVE, NO HARD CODING
Function Name: piCrust Inputs: 1. (cell) Your pie (a cell array), with kind words from Mary Berry hidden in the layers of the pastry (nested cell arrays)
Outputs: 1. (char) A sentence from Mary Berry, extracted from the layers of your pie pastry 2. (double) Maximum number of layers in your pie pastry Topics: (unnesting), (string manipulation)
Background: After the signature challenge, Paul Hollywood kneaded your spirits harder than an enriched dough and now youre feeling pretty down. Lucky for you, hidden inside the lamination of your pie pastry from the technical are warm, comforting words of wisdom from Mary Berry herself. If you can find these words and make them into a sentence, you stand a chance at turning your weekend around and pulling out a great bake during the showstopper challenge. Elizabeth may be the Queen of England, but Mary Berry is the Queen of Your Heart!
Function Description: You are given a pie (cell array) with Mary Berrys words of encouragement tucked into the layers of the pastry (nested cell arrays). For the first output, unnest the words and form them into a sentence. You should put spaces in between the words when you form the output sentence. The second output should be the largest number of layers (deepest nested cell array) in your pastry. On your marks, get set, BAKE!
Example: pie = {'you', {{{{'can'}}}}, {{'definitely see'}}, {{{'the'}}}, {{{{{{'layers here'}}}}}}} [maryBerrySays, maxLayers] = piCrust(pie) maryBerrySays -> 'you can definitely see the layers here' maxLayers -> 7
Notes: The input is guaranteed to only have 1 row. The contents of the unnested cells will always be type char. There should not be an extra space at the beginning or end of the output sentence. Hints: iscell(), ischar(), or class() may be useful in this problem.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
