Extracting a result of a looped finction from the workspace
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Adam Kepinski
el 2 de Mzo. de 2018
Comentada: Adam Kepinski
el 2 de Mzo. de 2018
Hi,
I ran a lagged regression 60 times and I got the coefficients printed in the command window (picture is attached). I'm stuck trying to extract one same cell from every table (row 2, column 3) into one array.
This is the function used to obtain tables: tmp = table2array(mdl.Coefficients)
Any help would be appreciated.
2 comentarios
KL
el 2 de Mzo. de 2018
Your attachment is not quite useful. It would be helpful if you give an example of what you have and what you want to have.
Respuesta aceptada
KL
el 2 de Mzo. de 2018
Editada: KL
el 2 de Mzo. de 2018
You're replacing the value of tmp during every iteration. Pre-allocate tmp with a proper size and store every iteration at its respective index.
For example, before you start the loop declare tmp
tmp = zeros(h,1);
and then inside the loop replace your last line with,
tmp(c,1) = mdl.Coefficients(2,3);
P.S: attaching screenshots don't help much. Just copy paste your code here and format it using {} Code button.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!