Ask Question
29 December, 11:05

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.

+2
Answers (1)
  1. 29 December, 13:43
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers