matrix1:matrix2 ?

5 ビュー (過去 30 日間)
SINDU GOKULAPATI
SINDU GOKULAPATI 2021 年 9 月 20 日
編集済み: KSSV 2021 年 9 月 20 日
a=[1 2 3; 4 5 6]
b=[1 2; 3 4 ; 5 6]
when i execute a:b
the ans is always 1 irrespective of the matrix values
what exactly does this operation do ?

採用された回答

KSSV
KSSV 2021 年 9 月 20 日
編集済み: KSSV 2021 年 9 月 20 日
It means :
a=[1 2 3; 4 5 6] ;
b=[1 2; 3 4 ; 5 6] ;
a(1):b(1)
ans = 1
i.e. it is taking a(1,1) and b(1,1) and trying to make a linspace from a(1,1) to b(1,1). As the respective values are 1 each, so you are getting only 1. Change b(1,1) t0 5 and see.
a=[1 2 3; 4 5 6] ;
b=[5 2; 3 4 ; 5 6] ;
a:b
ans = 1×5
1 2 3 4 5

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by