필터 지우기
필터 지우기

How to create a wire of white dots

조회 수: 4 (최근 30일)
maria
maria 2015년 7월 7일
편집: Thorsten 2015년 7월 7일
Hello, I am quite clumsy in Matlab. I want to make a wire of white dots on a black surface. Something like that:
1 1 0 0 0 1 1 0 0 0 1 1; 1 1 0 0 0 1 1 0 0 0 1 1;1 1 0 0 0 1 0 0 0 1 1;
but in a matrix 2500x2500; if I use:
array=zeros(2500)
for i=1:4:2500;
for j=1:4:2500
array(i,j)=1;
end
end
then I only have one dot instead of 2; How to change it? What if I want 20 black pixels for 5 white?

채택된 답변

Thorsten
Thorsten 2015년 7월 7일
편집: Thorsten 2015년 7월 7일
N = 2500;
line_element = [1 1 0 0 0];
I1 = repmat(line_element, N, N/numel(line_element));
line_element = [ones(1,5) zeros(1,20)];
I2 = repmat(line_element, N, N/numel(line_element));
imshow([I1 I2])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by