phoneBook - fn = names{x}; %this will give the string of...

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

View Full Document Right Arrow Icon
function num = phoneBook(st,nm) %function to return the given person's phone number; there are two fields, %one titled name and the other titled number %usage: num = phoneBook(st,nm) if names = {}; %this will produce a cell array of all of the names in the structure for x = 1:length(names) %takes the positions from 1 to the length of the names
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fn = names{x}; %this will give the string of whatever name is in the x position if strcmp(fn,nm) %compares the string obtained to the name input num = st(x).number; %gives the number of the position of x if the conditional is true end end end...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online