How to create a matrix B=[bij]=[max(i,j)] belongs to class of rectangular matrices

3 ビュー (過去 30 日間)
Farooq Aamir
Farooq Aamir 2018 年 2 月 9 日
回答済み: Christine Tobler 2018 年 2 月 12 日
Please answer me

採用された回答

Birdman
Birdman 2018 年 2 月 9 日
One way is symbolical:
i=3;j=4;
B=sym('B',[i j])
  2 件のコメント
Farooq Aamir
Farooq Aamir 2018 年 2 月 9 日
Thanks birdman but how i get without symbolic
Birdman
Birdman 2018 年 2 月 9 日
i=3;j=4;B=string(zeros(i,j));
for a=1:i
for b=1:j
B(a,b)=sprintf('b%i%i',a,b);
end
end

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

その他の回答 (1 件)

Christine Tobler
Christine Tobler 2018 年 2 月 12 日
Focusing on the max(i, j) part, you could use
i = 3;
j = 4;
B = max((1:i)', (1:j));

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by