How to I add loop vector iteration values to one big matrix?
Show older comments
I have a loop that iterates a function 6 times, each time it produces a matrix. How do I add each iteration to a single matrix in a new column? I should see a 6x6 matrix at the end of the loop.
I would like X matrix to have all 6 rows answers. A single iteration of this function will provide an answer that will look similar to this:
2904.5 3019.3 3065.7 3070.6 3044.3 2996.1
The loop code:
for phi=0.5:0.2:1.5
X=Function(3000,1,phi)
end
The code above just replaces each iteration so I just see one line.
I tried to use something along the lines the code below, but it will not work, or will add everything to one row. (one other function would work if the answer is one variable, but will not work if there are multiple variables in one row)
it = it+1
X(it)=Function(3000,1,phi)
Thanks again!
4 Comments
madhan ravi
on 6 Oct 2018
Edited: madhan ravi
on 6 Oct 2018
What have we tried in Function?
Stephen23
on 6 Oct 2018
"The output will be a 1x5 matrix"
but in your question you show a 1x6 vector. Which is correct?
cancel077
on 6 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!