DeGracia_Miguel_1948 - Miguel De Gracia 19481379 Lab Assignment 3 Section 22 Problem 1 M MyCell = cfw'Cal'Golden'Bears Problem 1a t1=

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
%% Miguel De Gracia. 19481379. Lab Assignment 3. Section 22. % %% Problem 1 % MyCell = {'Cal' 'Golden' 'Bears'} M %% Problem 1a % t1= MyCell{2}%It returns the character that is inside the cell array element, %Golden. t2= MyCell(2)%Gives the element in the cell array, therefore the information is %left as cell element. t3= MyCell{2}(1)%Goes to the second cell element in the array, Golden, and gets %the first element inside the cell component, G. t4= MyCell{end}(end)%Goes to the last cell in the cell array, Bears, then finds %and displays the last character, s. t1 = MyCell(:)%Displays t1 as a column vector containing the information that %is in the cell array, therefore the information is left as cell. MyCell{:}%This command asks MATLAB to look in side the cell, providing three %different answers, each of them being characters. t1 = [MyCell(:)]%Displays t1 as a column vector containing the information that %is in the cell array, therefore the information is left as cell. t2 = {MyCell(:)'}%At first it returns a column vector that contains the %information in each cell. We take the transpose and it now becomes a 1x3 row %vector, then the resulting information is placed in a cell. t3 = [MyCell{:}]%Displays a row vector because it looks inside each cell, and %displays it as a char now. t4 = {MyCell{:}}%Looks inside each element resulting in a 1x3 row vector but %it is now char. Then we replace this information into a cell, so the resulting %vector is a 1x3 cell. t1 = MyCell(2:3)%Provides the last two cells of MyCell, since () were used it %results as class cell. [t2,t3] = MyCell{2:3}%Looks inside second and third cell of MyCell and assigns %the answers to t2 and t3 as char since {} were used. % %% Problem 1b % v=[MyCell{1},' ', MyCell{2},' ', MyCell{3} ] v %% Problem 2 % A = {'Golden', {'Bears'}, [3,1;4,2]} B = [{'Golden'}, {{'Bears'}}, {[3,1;4,2]}]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course ENGINEERIN 7 taught by Professor Patzek during the Spring '08 term at University of California, Berkeley.

Page1 / 5

DeGracia_Miguel_1948 - Miguel De Gracia 19481379 Lab Assignment 3 Section 22 Problem 1 M MyCell = cfw'Cal'Golden'Bears Problem 1a t1=

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online