
To create:
The length of the character

Answer to Problem 7.1P
Solution:
The script is saved and executed as follows.
Explanation of Solution
MATLAB Code:
clc
clear all
close all
string = input('Enter a string: ','s');
%Define the instruction to enter a string.
fprintf('The number of character used in a string: %d\n', length(string))
%Define the length of the string.
fprintf('The first character used in the input string is: %s\n', string(1))
%Define the instruction to print the first character of the input string.
fprintf('The last character used in the input string is: %s\n', string(end))
%Define the instruction to print the last character of the input string.
Save the MATLAB script with name, chapter_7_54793_7_1P.m in the current folder. Execute the script by typing the string name at the command window to create the length of the character vector and also its first and last characters.
Result:
Therefore, the script is saved and executed.
Want to see more full solutions like this?
Chapter 7 Solutions
MATLAB: A Practical Introduction to Programming and Problem Solving
- The following data represent total ventilation measured in liters of air per minute per square meter of body area for two independent (and randomly chosen) samples. Analyze these data using the appropriate non-parametric hypothesis testarrow_forwardeach column represents before & after measurements on the same individual. Analyze with the appropriate non-parametric hypothesis test for a paired design.arrow_forwardShould you be confident in applying your regression equation to estimate the heart rate of a python at 35°C? Why or why not?arrow_forward
- Given your fitted regression line, what would be the residual for snake #5 (10 C)?arrow_forwardCalculate the 95% confidence interval around your estimate of r using Fisher’s z-transformation. In your final answer, make sure to back-transform to the original units.arrow_forwardCalculate Pearson’s correlation coefficient (r) between temperature and heart rate.arrow_forward
- Glencoe Algebra 1, Student Edition, 9780079039897...AlgebraISBN:9780079039897Author:CarterPublisher:McGraw HillLinear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage LearningAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage

