フィルターのクリア

what is the difference between the 2 codes ?

2 ビュー (過去 30 日間)
kay Dee
kay Dee 2021 年 4 月 8 日
編集済み: James Tursa 2021 年 4 月 8 日
g= zeros([2,2])
f= zeros(2,2)

回答 (1 件)

James Tursa
James Tursa 2021 年 4 月 8 日
編集済み: James Tursa 2021 年 4 月 8 日
zeros([2,2]) passes one argument, a 2-element vector [2,2].
zeros(2,2) passes two arguments, the scalars 2 and 2.
The result is the same, a 2x2 matrix filled with 0's.
For a square matrix result, you could also have used a single scalar argument and got the same result:
zeros(2)

カテゴリ

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