12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

To index nested cell arrays, use as many sets <strong>of</strong> curly brackets { <strong>and</strong>} as needed to get you to the level <strong>of</strong> nesting required, then use roundbrackets ( <strong>and</strong> ) to access their contents. For example:>> tt = {t {’Barney Rubble’ {[-1 1] , ’Bedrock’}}}tt ={1x2 cell}{1x2 cell}>> cellplot(tt)>> tt{2}ans =’Barney Rubble’ {1x2 cell}>> tt{2}{2}ans =[1x2 double] ’Bedrock’>> tt{2}{2}{1}ans =-1 1>> tt{2}{2}{2}ans =Bedrock>> tt{2}{2}{1}{2}??? Cell contents reference from a non-cell array object.>> tt{2}{2}{1}(2)ans =1Exercise 11 Do you know where the word “stuck” has comefrom in the following example (answer on page 189):c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!