Initiating a For Loop!
Afficher commentaires plus anciens
CS 1371, the class for Matlab, has been fairly easy up to this week, but, for some reason, I do not understand iteration. My question is about For Loops. My code is supposed to run from the beginning of a vector to the end of a vector, using those values to index an array, but I can only get it to index the first value, and it is probably because I am not initiating my For Loop correctly. The variable "moves" is a 2Xn vector, and each column is used to find the value of that position in "map" I will post the relevant section of my code below:
n=[];
vec=moves(1,length(moves));
for arr=vec;
ogpos=moves(:,1);
ogposcat=ogpos';
movenext=(ogposcat(1),ogposcat(2));
movesnext= map(movenext);
end
I greatly appreciate any of your help!!!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements 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!