How to generate random parking lot size?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I want to create a parking lot by plotting with random number of lots depending on its dimensions (each lot is 6m x 3m) and the min value is 4 rows x 6 columns to 8 rows and 8 columns. Can anyone help me?
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 4월 7일
[randi([4 8]), randi([6 8])]
댓글 수: 2
Walter Roberson
2021년 4월 7일
format long g
r = randi([4 8])
c = randi([6 8])
d = char(logical(repelem(checkerboard(3, r, c),2,1)) + ' ');
e = d(1:end/2, 1:end/2)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!