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

Solve Exercise 25 of Chapter 7 with the following additions. You are to create a

ID: 3679253 • Letter: S

Question

Solve Exercise 25 of Chapter 7 with the following additions. You are to create a meaningful message of least 5 words. Each of the words of the message will come from the first characters of the words of a separate sentence. To the process, write a MATLAB program to create a matrix with each sentence as a separate row. Write a function to decode the message from the sentences in the matrix and return the message that was contained in the matrix your program created. Hand in the programs, the matrix of sentences, and the decoded message produced by your programs. Write and run a MATLAB program that "shuffles" a deck of 52 playing cards, then deals the first 7 cards. The cards may be in any suit and numeric order. Since these are strings, use an sprint statement with $ format to print the output or use the sprint statement. A sample of how the output is to look is shown.

Explanation / Answer

card_nums = ('A23456789TJQK')';
card_suits = ('HDSC')';
deck_nums = repmat(card_nums,4,1);
deck_suits = repmat(card_suits,13,1);
cell_nums = cellstr(deck_nums).';
cell_suits = cellstr(deck_suits).';   

%// Construct a struct array with fields 'value' and 'suit'
unshuffled_deck = struct('value',strcat(cell_nums,cell_suits));


shuffled_deck = unshuffled_deck(randperm(7));
for idx = 1:numel(shuffled_deck)
element = shuffled_deck(idx).value
element=strrep(element, 'H', ' Hearts ')
element=strrep(element, 'D', ' Diamonds ')
element=strrep(element, 'S', ' Spades ')
element=strrep(element, 'C', ' Clubs ')
sprintf('%s',element)
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