フィルターのクリア

Appending column vectors produced from a for loop

2 ビュー (過去 30 日間)
Arthur Batte
Arthur Batte 2020 年 7 月 18 日
回答済み: julian navas 2020 年 7 月 19 日
Hello, i wish to append end to end column vectors produced in a for loop. Eg if two column vectors given below are produced from a for loop.
1 8
2 6
3 1
4 9
these two column vectors then append/merge one at the end of the other to
1
2
3
4
8
6
1
9
Could anyone kindly assist on how to go around this. Kindly provide me a solution whereby the for loop was producing say 20 column vectors thereby appending all these 20 column vectors
thank you

採用された回答

julian navas
julian navas 2020 年 7 月 19 日
There are several ways to accomplish what you're saying, unfortunately the question does not provide enough information to delimit the scope of the answers you could get and thus the one you really need.
%option1
for i = 1:3
vec1 = rand(4,1)
vec2 = rand(4,1)
end
var = [vec1;vec2]
%option 2
var = [];
for i = 1:3
var = [var;rand(4,1)]
end
...and so on, depending on the data structure you have.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by