charInterp - % casting to a string. % % For interp1, use...

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

View Full Document Right Arrow Icon
% 9/9/09 9:18 PM % Function Name: charInterp % Inputs: 1. char vector (string) - a string that contains at least two % characters % 2. double - the size of the resulting string % % Output: 1. char vector (string) - the original string with interpolated % characters in it stretched to the given size % % Function Description: % This function takes in a string and a double and uses interpolation and % the ASCII values of the string to create a new string. The result must % be of the specified given size (double) and must be a string (of type % char). Do not do any rounding; MATLAB will take care of rounding when
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % casting to a string. % % For interp1, use the indices of the string as x values [1:length(str)]. % The new x values should be linerally spaced and should range from 1 to % the length of the string. % function newString = charInterp(str, size) oldX = linspace(1, size, length(str)); % the "x" values of the set to interpolate off of newX = linspace(1, size, size); % the "x" values of the new interpolated set newString = char(interp1(oldX, double(str), newX));...
View Full Document

Ask a homework question - tutors are online