How to create exportable table from outputs of function iterated using for loop?
Show older comments
I have a working function which I have created which takes 6 inputs and puts out 4 outputs which are Rg, GPR, Es and Em. I am trying to iterate the function using a for loop which starts at a value of 50 and goes to 500 in steps of 10. For each index value x, I would like to populate a row of a table using 5 columns for the 4 outputs plus the itteration index.
Here is my code:
for x = 50:10:500
Design2 = gnd(144,120,6,5,22,x); % Calls my function
table1(x,:) = [x Rg GPR Es Em] % Create table from outputs of Design2 filling a multi-row by 5 column table
end
I have tried the cell method and some other table methods but I cannot get it to work. The code I have above says it does not know the variable Rg. How can I connect the output of the gnd function into each of the table columns?
I appreciate your time and guidance with this. I have searched google and matlab answers to no end and have not yet found a way to get it working.
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!