The results of a code place them at the entry of the same code.

Hi. Goodnight. I have a matrix 20 X 5 at the entrance of my code, the matrix "Prog" Later this matrix enters to the code, it is processed and at the end I have a matrix result of 20 X 5, the matrix "M" What I want to do and I have not been able to do, is to take the values of the matrix "M" and enter them into the "Prog" matrix. I will do this at least 1000 times. At the end of the code I put this: Prog = M but it does not work.
I hope you give me guidance, advice, suggestions, solutions, ... etc, etc, etc,
Greetings and thanks.

6 Comments

Can you upload the code? Also, what is the purpose of replacing Prog with M 1000 times?
I can not send the code because it is a school task and I almost finished it. The code chooses the best results of a numerical process and these results are put back into the code, until the optimal values are obtained. It is an optimization algorithm in this case is an Optimization by Ant Colony(ACO). Thank you very much for your attention
It's pretty hard to fix a code without seeing it... Can you at least show us the error you're getting when Prog = M fails?
"At the end of the code I put this: Prog = M but it does not work."
What is this line of code and the error that is returned? All the red text.
It sounds a little bit like you want a recursive function (maybe a loop would do aswell), but i agree with OCDER without knowing what problems you are facing and without seeing any code we can only speculate.
Or just an iterative function:
M = randn(20,5);
for K = 1 : 1000
M = Prog(M);
end
It is true what you say, it is very difficult to give advice if you do not have the complete code. For privacy reasons I can not put the full cogigo. Anyway thanks for answering

Answers (0)

This question is closed.

Products

Release

R2015a

Asked:

on 21 Jun 2018

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!