You can create an alternating array of 1's and 0's in MATLAB using the repmat
function to repeat the pattern as many times as desired. Here's a simple example to create an alternating array of length n
:
main.m163 chars6 lines
This code snippet will create an alternating array of 1's and 0's of length n
. You can adjust the value of n
to generate arrays of different lengths.
gistlibby LogSnag