Question: Matlab Function help please: Function Name halloweenParty Inputs 1. ( cell) 1xN cell array with information about your party Outputs 1. (struct) 1x1 structure with

Matlab Function help please:

Function Name halloweenParty

Inputs

1. ( cell) 1xN cell array with information about your party

Outputs

1. (struct) 1x1 structure with the fields and their values

Banned Functions

cell2struct

Background

Youre trying to throw a well- structuredHalloween party. All of those pesky party

planning particulars prevent proper party planning, so you turn to structures to organize the data

for your spook-tacular Halloween party.

Function Description

Given a cell array of the format { field1, value1, field2, value2...} , write a

function that outputs a structure with each field name and the corresponding value for the field.

Each field name is at the odd indices in the array and the respective value is at the adjacent

even index.

Example

>> ca = {'SpookFactor',1371,'IsLame',false,'Location','Culc 272'}

>> st = halloweenParty(ca)

>> st

SpookFactor: 1371

IsLame: false

Location: 'Culc 272'

Notes

The length of the input cell array will be even so that the values can be split up into

field/value pairs.

The values can be of any type, but the fields are guaranteed to be character vectors

Hints

Iteration might be useful to build the structure.

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!