How to replace zero with a number in null matrix at required position

A simple case like this
1.PNG
I want to replace the some elements with other numbers like this
2.PNG

 採用された回答

Raj
Raj 2019 年 6 月 19 日

0 投票

I see no specific pattern in your modified matrix. So just use proper indexing to insert the required number at required location.
A=zeros(5)
A(1,5)=7
A(2,2)=8
A(3,5)=2
A(4,2)=4
A(5,3)=1
Its quite trivial so I am not sure if this is what you are looking for.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

リリース

R2014b

質問済み:

2019 年 6 月 19 日

コメント済み:

2019 年 6 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by