matlab I want to write matlab Code for this question but i stuck i need help Que
ID: 1717495 • Letter: M
Question
matlab
I want to write matlab Code for this question but i stuck i need help
Question4:110pt Wnite a program to solve the following problem The program reads from the user bwo arays, the fest array contains unknown number af elements while the second aray (pattem) contains exactly bwo elements. The prog am searches the first array to count and record ail cccurences of the second amay. Then it prints how many times the second aray (pattem is found and where The progam should also ask the user to continue or not and according to the user decision the program se-ask the userto enter the srays or to stop and say Good Bye! The input and output of the program shoud look like the shown example Example Enter amay I1 2 34567812 312 31 Emer patem: [1 21 The patiem is found 3 Smes) at the following rostions Do you wart so consnue tpnyy Enter amay: 11 2 34 56781 231231 Do you want to contnue tynty Enr me 1 3 31 3 67231 31 The patism is founa 1 smaisi c he folloing pcations Do you ware to costnue (yinynExplanation / Answer
A = [4 16 36 64 1 9 25 49 81]; B = zeros(1, 9); % Pre-allocate! for ii = 1:9 [value, index] = max(A); B(ii) = value; A(index) = -Inf; end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.