Storing x and y data calculated in loop as arrays to be used in the creation of a table.
Afficher commentaires plus anciens
Hello. I am currently taking data during a loop (changing an outside variable M with each loop). This data is in the form of two arrays of length N. As of now my code plots these arrays and then goes on to the next loop, overwriting the arrays. I am wondering how I might store these values, to create a table something like this, adding columns x and y for each M(iteration). I would then try to export it to a csv/excel, but that's later I suppose lol.

I tried to create an empty array of zeros(N, 2*M) and then assign the x and y of each iteration to the i and i+1 (odds and even) respectively, but that wasn't fruitful. Do you folks have any other ideas as to what I might do?
Réponse acceptée
Plus de réponses (1)
You can use table data object in matlab.
Best
x = 1:4';
y = 1:4';
M1 = table(x,y)
M2 = table(x,y)
M3 = table(x,y)
T = table(M1,M2,M3)
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!