There is a " for loop" in my program and Matlab gives me a suggestion to consider "Preallocating" for speed. I want to learn how to do it. This is my code:
A = [];for i = 1:size(P,2) Ai = build_matrix(P(:,i)); *A* = [A; Ai];end
there is a red line under A on Bold saying that The size of the indicated variable or array appears to be changing with each loop iteration. Could you guys tell me what should I do to solve it. Thanks!!
Best Answer