フィルターのクリア

How to create array of alphanumeric

6 ビュー (過去 30 日間)
Vishal Sharma
Vishal Sharma 2017 年 2 月 4 日
コメント済み: Stephen23 2017 年 2 月 4 日
I want to make array of A1 A31 A61 A91 Please suggest me code

採用された回答

Stephen23
Stephen23 2017 年 2 月 4 日
編集済み: Stephen23 2017 年 2 月 4 日
You could create a cell array of strings:
C = {'A1','A31','A61','A91'}
Or if you have R2016b or newer, then you could use strings:
S = string({'A1','A31','A61','A91'})
  2 件のコメント
Vishal Sharma
Vishal Sharma 2017 年 2 月 4 日
Sorry,,, my question was incomplete... I have one string array [A B C D ...]
I have another numeric vector, say B = [1:2:20]
I want to create a alphanumeric array as per following result
A1 A3 A5 A7.... B1 B3 B5 B7 C1 C3 C5 C7....
Stephen23
Stephen23 2017 年 2 月 4 日
If you have R2016b or newer then use strings (untested):
B = 1:2:20;
S = string({'A','B','C','D'});
S+B(:)
For older version you could do something like this:
>> B = 1:2:20;
>> C = {'A','B','C','D'};
>> N = arrayfun(@num2str,B(:),'Uni',0);
>> Z = strcat(repmat(C,numel(B),1),repmat(N,1,numel(C)));
>> Z = Z(:)'
Z =
Columns 1 through 15
'A1' 'A3' 'A5' 'A7' 'A9' 'A11' 'A13' 'A15' 'A17' 'A19' 'B1' 'B3' 'B5' 'B7' 'B9'
Columns 16 through 30
'B11' 'B13' 'B15' 'B17' 'B19' 'C1' 'C3' 'C5' 'C7' 'C9' 'C11' 'C13' 'C15' 'C17' 'C19'
Columns 31 through 40
'D1' 'D3' 'D5' 'D7' 'D9' 'D11' 'D13' 'D15' 'D17' 'D19'

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by