Contents

clc
clear all

IDENTIFICATION

Name: Autar Kaw (Put your name here) Section : 001 (Put Section here) Semester: Fall 2011 Due Date & Time: August 29, 2011 (Put due data and time here)

disp('Name: Autar Kaw (Put your name here)')
disp('Section : 001 (Put Section here)')
disp('Semester: Fall 2011')
disp('Due Date & Time: August 29, 2011 (Put due data and time here)')
Name: Autar Kaw (Put your name here)
Section : 001 (Put Section here)
Semester: Fall 2011
Due Date & Time: August 29, 2011 (Put due data and time here)

BACKGROUND and DESCRIPTION

Title: Sample program to show how to use strings and how to combine two or more strings into a single string with the conversion of a number to a string

disp('This program teaches how to use strings and concatenate them with the conversion of number to a string')
This program teaches how to use strings and concatenate them with the conversion of number to a string

INPUTS

%variable "e" contains the stirng
e ='I have ';
%f is a variable containing number
f =3;

CODE

%fs is variable containing string
%num2str is command that changes number to a string
fs=num2str(f);
g =' cats';
% h is a string which contains the concatenated(combined) string
h =[e,fs,g];

OUTPUT

fprintf('  %s\n',h)
  I have 3 cats