Ask Question
30 July, 02:39

Write a function called interleave to interleave two row arrays of equal length. Ex: For row arrays arrayOne and arrayTwo, the output row array is arrayThree = [arrayOne (1), arrayTwo (1), arrayOne (2), arrayTwo (2), ...]. The function should work for rows of any length. Hint: Create a new array by concatinating arrayOne and arrayTwo, then flattening the array to finally end up with the desired row array. No internal functions are needed. Ex: Flattening a=[1,2; 3,4] gives [ 1; 3; 2; 4]. Restrictions: For and while loops should not be used.

+5
Answers (1)
  1. 30 July, 05:02
    0
    function [ repPos, pinCodeFix ] = pinCodeCheck (pinCode)

    pinCodeFixTemp = pinCode;

    repPosTemp = [];

    for i = 1:length (pinCode)

    if ((i > 1)) & (pinCode (i) = = pinCode (i - 1))

    repPosTemp ([i]) = i;

    else

    repPosTemp ([i]) = 0;

    end

    end

    for i = 1:length (pinCode)

    if (repPosTemp (i) > 0)

    pinCodeFixTemp (i) = 0;

    end

    end

    repPosTemp = nonzeros (repPosTemp);

    pinCodeFixTemp = nonzeros (pinCodeFixTemp);

    repPos = repPosTemp';

    pinCodeFix = pinCodeFixTemp';
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function called interleave to interleave two row arrays of equal length. Ex: For row arrays arrayOne and arrayTwo, the output row ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers