10 by 10 matrix grid

조회 수: 4 (최근 30일)
Tarek Eid
Tarek Eid 2020년 3월 5일
댓글: Tarek Eid 2020년 3월 10일
Hi all
Im trying to make a battleship game and as a start i need to make a 10*10 matrix grid with (letter,number) coordinates. Ex: A6,C3,D4
That is, i need the first column of every row to be a letter from (a-j) and the the rest to be numbers with 1 on the top and 10 at the bottom
How do i do this?
thanks in advance
  댓글 수: 2
David Hill
David Hill 2020년 3월 5일
I would just set up a matrix of zeros
BSgrid=zeros(10);
Then 'A6' index can just be converted to (1 6) to index into the matrix.
Tarek Eid
Tarek Eid 2020년 3월 10일
That did the trick
thanks David

댓글을 달려면 로그인하십시오.

답변 (1개)

Stephen23
Stephen23 2020년 3월 5일

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by