{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ABCs_cell_arrays

# ABCs_cell_arrays - B =%fill in this line B c Deleting Write...

This preview shows page 1. Sign up to view the full content.

function [A B C D E] = ABCs_cell_arrays(C, ca1, ca2) % ABCs of Cell Arrays % % This is a multi-part problem. Do each of the parts below. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % % a) Creating. Create a cell array with the length of 4 where the first % element is the number 42, the second element is a string 'CS rocks', the % third element is a vector [8 3 12 12 15] and the fourth element is a % logical vector [true true false true]. Store your result in a variable % named A. A = {42, 'CS rocks', [8 3 12 12 15], logical([1 1 0 1])};%fill in this line A % b) Empty Cell Arrays. Create an empty cell array. Store your result in a % variable named B.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: B = {};%fill in this line B % c) Deleting. Write the code to delete the second cell of the cell array % stored in the variable C. For example, if C = {[true false], 'hi', 12}, % after running the code, C should equal {[true false], 12}. C(2) = ;%fill in this line C % d) Accessing. Create a new cell array of length 3 and named D that % contains the 2nd and 3rd and 5th elements of ca1, which is also a cell % array. D = {ca1{2}, ca1{3}, ca1{5}};%fill in this line D % e) Class/Type. What is the class/type of the second element in ca2? Store % your result in a variable named E. Use the class() function. E = class(ca2{2});%fill in this line...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online