ABCs_cell_arrays

ABCs_cell_arrays - % 1st and 2nd and 4th elements of the...

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

View Full Document Right Arrow Icon
function [A B C D E F] = ABCs_cell_arrays(D,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 % cell contains a vector [1 0 1 0], the second cell contains a string 'I % love CS1371', the third cell contains a cell containing a vector of % numbers [11,12,13,14], and the fourth cell contains a logical vector % [true true false true]. Store your result in a variable named A. A = {[1 0 1 0] 'I love CS1371' {[11 12 13 14]} [true true false true]}; A % b) Empty Cell Arrays. Create an empty cell array. Store your result in a % variable named B. B = {}; B % c) Accessing and Indexing. Create a cell array named C that contains the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % 1st and 2nd and 4th elements of the cell array ca1. C = ca1([1 2 4]); C % d) Deleting. Write the code to delete the third cell % of the cell array D. Store this modified array in D. % For example, if D = {[1 0 1 0], 'I love CS1371', {[11,12,13,14]}, [true true false true]}, % after running the code, D should equal{[1 0 1 0], 'I love CS1371', [true true false true]} D(3)=; D % e) Class/Type. What is the class/type of the second element in ca2? Store % your result in a variable named E. E = class(ca2(2)); E % f) Class/Type. What is the class/type of the contents of the second cell % of ca2? Store your result in a variable named F. F = class(ca2{2});...
View Full Document

Ask a homework question - tutors are online