フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

A question about generating a matrix

1 回表示 (過去 30 日間)
Yuxing Zhang
Yuxing Zhang 2018 年 10 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
If I want to have a matirx which follows the change of n, says when n=2, A=[0 1] when n=3,A=[0 0 1], n=5, A=[0 0 0 0 1]. How can I achieve this goal using code? Thank you.

回答 (1 件)

Bruno Luong
Bruno Luong 2018 年 10 月 11 日
clear A
A(n) = 1
  2 件のコメント
Yuxing Zhang
Yuxing Zhang 2018 年 10 月 11 日
Thank you very much, can I ask for what if I want to generate A=[o;o;1]?
Bruno Luong
Bruno Luong 2018 年 10 月 11 日
編集済み: Bruno Luong 2018 年 10 月 11 日
Presumably you want "0" and not "o", add the following
A=A(:)
or
clear A
A(n,1) = 1

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by