Class Notes (1,100,000)
CA (650,000)
York (40,000)
ITEC (400)
Lecture 4

ITEC 2600 Lecture 4: ITEC2600 A2


Department
Information Technology
Course Code
ITEC 2600
Professor
Xiaofeng Zhou
Lecture
4

This preview shows half of the first page. to view the full 3 pages of the document.
ITEC2600 Assignment 2 York University
ITEC 2600 Introduction to Analytical Programming
Assignment ]2
Winter 2017
Due: Mar.18, 11:55pm, 2017
Submission Instructions:
Use Moodle to submit your work.
At the top of each file introduce your name and student number as a comment.
Write a main M-file which can execute all the following questions if necessary.
1. Create a row vector cell array to store the string ‘xyz’, the number 33.3, the vector 2:6, and the
logical expression ‘a’ <‘c’. Use the transpose operator to make this a column vector, and use
reshape to make it a 2 x 2 matrix. Use celldisp to display all elements.
2. Write a function catit that will receive one input argument which is a cell array. If the cell
array contains only strings, it will return one string which is all of the strings from the cell array
concatenated together-otherwise, it will return an empty string. Here is one example of calling
the function:
>> fishes = {'tuna','shark','salmon','cod'};
>> catit(fishes)
ans=
tunasharksalmoncod
3. Write a function buildstr that will receive a character and a positive integer n. It will create and
return a cell array with strings of increasing lengths, from 1 to the integer n. It will build the
strings with successive characters in the ASCII encoding.
>> buildstr('a',4)
ans =
’a’ ’ab’ ’abc’ ’abcd’
i
You're Reading a Preview

Unlock to view full version