Question: For MATLAB Part 1: Create a structure called sentenceCompare that contains two fields: str and str2. Each of these fields should contain a unique sentence

For MATLAB For MATLAB Part 1: Create a structure called sentenceCompare that contains two

Part 1: Create a structure called sentenceCompare that contains two fields: str and str2. Each of these fields should contain a unique sentence string (e. "What is your name?", "What is your favorite color?"). Example: >> sentenceCompare sentenceCompare - struct with fields: stri: "What is your name?" str2: "What is your favorite color?" Part 2: Using your structure from Part 1 to access the two sentence strings, determine if the first word of string 1 is the same word as the first word of string 2. Note: the comparison should be case insensitive (i.e. "What" = "WHAt"). Add a new field to the structure called first Word that contains a 1 If the first words are the same and a 0 If the first words are different Display the final contents of your structure using displ) or fprintf(). Hint: Consider using the split() and strcmp() functions in your solution. Output: strl: What is your name? str2: What is your favorite color? firstWord: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!