Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to change the last row of a vector to a sum of the vector?

3 ビュー (過去 30 日間)
Nicholas Costa
Nicholas Costa 2018 年 2 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
So I have this vector TB12_stats=200+rand(17,1)*200 and I want to change row 17 to the sum of rows 1 through 16 and I have no clue how to do this??
  5 件のコメント
Jos (10584)
Jos (10584) 2018 年 2 月 1 日
I appreciate your honesty :) Here are some hints
M = magic(5)
T = M(1:4,:)
S = sum(T,1)
Rik
Rik 2018 年 2 月 1 日
Do you know how to assign a value to one position in a vector? Do you know how to get several consecutive elements from a vector? Do you know the method in Matlab to calculate a sum?
If you don't know the solution to a problem, try to break it down to parts you do know the solution for.

回答 (1 件)

Star Strider
Star Strider 2018 年 2 月 1 日
See the documentation on Matrix Indexing (link). That should help you assign ‘TB12_stat(17)’.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by