Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Drawing something simple with MATLAB

2 visualizzazioni (ultimi 30 giorni)
Enis
Enis il 27 Ott 2011
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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 Commento
Enis
Enis il 27 Ott 2011
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.

Risposte (3)

Ajay Kumar
Ajay Kumar il 27 Ott 2011
disp(' ')
disp('X...X')
disp('.X.X.')
disp('..X..')
disp('.X.X.')
disp('X...X')
disp(' ')

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

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

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by