what is the meaning of for A(1,1:8) where A is a matrix
86 views (last 30 days)
Show older comments
need this solution in manipulation of matrix
0 Comments
Answers (3)
Azzi Abdelmalek
on 24 Aug 2015
1 Comment
Walter Roberson
on 24 Aug 2015
To summarize:
A(1,1:8)
will be a row vector composed of the first 8 elements of row 1 of A, equivalent to [A(1,1), A(1,2), A(1,3), A(1,4), A(1,5), A(1,6), A(1,7), A(1,8)]
Thong Tran
on 9 Jul 2021
a = 1 : 4 : 8
1 Comment
Walter Roberson
on 9 Jul 2021
The 4 is the increment between elements. See https://www.mathworks.com/help/matlab/ref/colon.html#bvg1wnp-i
Tapan
on 21 Aug 2022
S = 1:4:9
1 Comment
Walter Roberson
on 23 Aug 2022
S = 1:4:9
As you can see, the first output is the same as the first entry of the 1:4:9 . You can see that for the second entry of the output, 4 has been added to the first entry of the output, and 4 is the same as the middle of the 1:4:9 clause. After that, 4 was added again to the second output, getting 9, and 9 is not greater than the third member of the 1:4:9 clause, so 9 is output. Then, 4 is added again to that output, getting 13, and 13 is greater than the third member of the 1:4:9 clause, so the 13 is not output, and the expansion of the expression stops.
See Also
Categories
Find more on Logical 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!