Write a MATLAB function called Ana3Name with 1 input Word an

Write a MATLAB function called Ana3_Name with 1 input (Word) and 1 output (Res). The input (Word) should have at least 3 letters. The function randomizes the order of the letters of the input Word then generates 3 anagram words with decreasing number of letters by 1, starting with an anagram with the same number of letters as the input Word Use the outcome as an index to the original word. Use a For Loop and create a cell variable using the counter as an index. Examples of a working function are shown below

Solution

% matlab code

function res = Ana3_Name(word)
if length(word) < 3
disp(\'word length should be atlest 3\ \');
exit
end
  
res = [];
  
for i=1:3
   p = randperm(length(word));
word = word(p);
res{i} = word;
   %disp(word);
   word = word(1:end-1);
end
end

res = Ana3_Name(\"AYUSH\");
disp(res);

%{
output:
HAYSU
HYSA   
SHY
%}

 Write a MATLAB function called Ana3_Name with 1 input (Word) and 1 output (Res). The input (Word) should have at least 3 letters. The function randomizes the o

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site