Info

此问题已关闭。 请重新打开它进行编辑或回答。

Drawing something simple with MATLAB

1 次查看(过去 30 天)
Enis
Enis 2011-10-27
关闭: MATLAB Answer Bot 2021-8-20
I need to write a code to produce the following pattern:
X...X
.X.X.
..X..
.X.X.
X...X
can anyone please help me with the code?
  1 个评论
Enis
Enis 2011-10-27
Actually, it has to be like this for any value of R specified, diagonals are X-es, the rest is dots. I got in a really simple way.

回答(3 个)

Ajay Kumar
Ajay Kumar 2011-10-27
disp(' ')
disp('X...X')
disp('.X.X.')
disp('..X..')
disp('.X.X.')
disp('X...X')
disp(' ')

Ajay Kumar
Ajay Kumar 2011-10-27
Try the above. It should work. This is the simplest if you are just trying to display characters

Walter Roberson
Walter Roberson 2011-10-27
Hint to get you started:
flipud(diag('XXXXX'))

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by