For loop element Matrix construction
Show older comments
I am currently writing an element based analytical program for Uni but have hit a wall. I have a for loop for a set number of elements within which a number of different equations each giving a different aspect of each element. So, for 10 iterations(i) (or 10 elements) i am calculating A(i) B(i) C(i) etc. and i want to put these in one table or matrix related to their element number so the colums are denoted by the element number and the rows have a diferent result in (A,B or C...). What code do i use to do this?
Accepted Answer
More Answers (2)
2 Comments
Jan
on 13 Nov 2012
I still do not understand the question. Where are "A, B, C, ..." created in your code? Why do you need a loop here? A vectorization would simplify the code.
In general creating "A, B, C, ..." is less efficient than creating a cell "A{1}, A{2}, ...", because the later can processed in a loop directly.
Mark
on 13 Nov 2012
Mark
on 13 Nov 2012
0 votes
Categories
Find more on Loops and Conditional Statements 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!