How to append a row vector to the variable?

Hello everyone,
I would like to get row vectors that created with loop to the 1 variable. How can I figure out?
I got data like below but could'nt get add another rows for each iterations to same variable
2.1618652 0 0 1.1779785 0 0 0 5.1105957 0 0 0 0 0 0.11596680 0 0 0 0.74658203
there, I mean I already have row data that I get every iterations. But I would like to create variable and to put that row data to the next row of the variable.
Many thanks for your supports.

 Accepted Answer

KSSV
KSSV on 6 Mar 2019
Edited: KSSV on 6 Mar 2019
Add them into the cell and later you can reshape to what you want. Read about Cells
Get the size of the array if row is one it is a row vector.

3 Comments

I mean I already have row data that I get every iterations. But I would like to create variable and to put that row data to the next row of the variable.
n = 3 ;
iwant = zeros(n,n) ;
for i = 1:n
A = rand(1,n) ;
iwant(i,:) = A ;
end
iwant = reshape(iwant',1,[])
Dear KSSV,
Your code is very useful for me to solved out. Many thanks, But we understand still. differently :)

Sign in to comment.

More Answers (0)

Products

Release

R2018a

Community Treasure Hunt

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

Start Hunting!