how to add headers to a matrix?

1 回表示 (過去 30 日間)
roshan varkey
roshan varkey 2013 年 12 月 1 日
コメント済み: Azzi Abdelmalek 2013 年 12 月 1 日
i have a matrix 10x10 of zeros under the name play_space......and i would like to name the rows A-J and columns 1-10,so the when i want to change some values in the matrix i will have to type in eg: play_space(B,3).
could someone please help?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 1 日
Why to use letters instead numbers?
A=rand(10)
A(2,3) % is simpler then using letters
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 1 日
編集済み: Azzi Abdelmalek 2013 年 12 月 1 日
X=rand(10)
A=1;
B=2;
C=3;
% and so on
X(A,3)
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 1 日
If you want to work with letters
A=rand(10)
h='A':'J'
A1=@(s,j) A(strfind(h,s),j)
A1('B',3)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by