Question
inputs: 1. (char) A character vector of three words Outputs: 1. (double) A 1x3 vector with the lengths of each word Background: You know how
inputs:
1. (char) A character vector of three words Outputs:
1. (double) A 1x3 vector with the lengths of each word
Background:
You know how sometimes you just really want to know the length of a word, but for specifically three word sentences? You don't?! Oh well, let's make a function to do it anyway.
Function Description:
Given a sentence of three words separated by spaces, find the length of each word and output the values as a vector.
Example:
lens = wordLen('Matlab rocks dude') lens [6 5 4]
Notes:
-
Words will only be separated by spaces.
-
There will never be any punctuation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started