How do I create a row vector P, that contains the sum of the values in column 2 and the sum of the values in column 5 of matrix B.
1 view (last 30 days)
Show older comments
Given: B=rand(randi([10 20]),randi([5 30]))
Find: Create a row vector P, that contains the sum of the values in column 2 and the sum of the values in column 5 of matrix B.
Issue: I am unfamiliar with the wording, or how to contain the two sums in one variable using code. Variable P must be of size [1 2].
My Solution: I got as far as to state >>P=sum(B(:,2); but I do not know how to get the required parameters.
0 Comments
Accepted Answer
More Answers (0)
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!