matrix1:matrix2 ?
2 views (last 30 days)
Show older comments
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 ?
0 Comments
Accepted Answer
KSSV
on 20 Sep 2021
Edited: KSSV
on 20 Sep 2021
It means :
a=[1 2 3; 4 5 6] ;
b=[1 2; 3 4 ; 5 6] ;
a(1):b(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
0 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!