weave - % % weaving the 2's % Second, 6th, 10th, etc. . rows

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function ret = weave(m,n) % Usage: ret = weave(m,n) % % Given two numbers, m and n, create an m x n array that creates a weave % pattern and returns it to the user. % % fill with zeroes ret = zeros(m,n); r % even columns => 1 ret(:,2:2:end) = 1; r % note that the weaving repeats every 4 columns
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % % weaving the 2's % Second, 6th, 10th, etc. . rows ret(2:4:end,1:4:end) = 2; ret(2:4:end,2:4:end) = 2; ret(2:4:end,3:4:end) = 2; % 4th, 8th, 12th, etc. . rows ret(4:4:end,1:4:end) = 2; ret(4:4:end,3:4:end) = 2; ret(4:4:end,4:4:end) = 2;...
View Full Document

Ask a homework question - tutors are online