Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem-2 Cells Usually, cells are most useful for storing strings because the l

ID: 3799858 • Letter: P

Question

Problem-2 Cells Usually, cells are most useful for storing strings because the length of each string can be unique a. Make a 4x4 cell where the first column contains the names: Kevin Natasha 'Dak' and Usain the second column contains their last names Hart St. Pier Prescott Bolt', the third column contains their occupations Comedian Singer "Quater back Athlete and the last column their salaries $850,000 $650,000 and $1,500,000 and $2,00,000. Display the cell using disp b. Modify the code you obtained in a. such that it displays a sentence of the form First Name Last Name is a/an Occupation and has a salar of Salar l". Do this using a "for loop" and display the sentences.

Explanation / Answer

% part 2 a
C = {'Kevin', 'Hart', 'Comedian', '$850,000'; 'Natasha', 'St. Pier', 'Singer','$650,000'; 'Dak', 'Prescott', 'Quaterback','$1,500,000'; 'Usain','Bolt', 'Athlete', '$2,00,000'};
disp(C)

% part 2 b
for i =1:4
disp(strcat(C{i,1}, {", "}, C{i,2}, {" is a/an "}, C{i,3}, {" and has a salary of "}, C{i,4}){1,1})
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote