Change variables in for loop
Afficher commentaires plus anciens
Hello,
so I want to change variables in a for loop to use them in inpolygon.
I have the variables x_e1, x_e2, x_e3, y_e1, y_e3, y_e3 (and x,y) in my workspace (all of them are k long).
Unfortunately, my code below doesn't work.
for k=1:length(x)
for e=1:1:3
[in(k,e),on(k,e)]=inpolygon(x,y,strcat('x_e',num2str(e)),strcat('y_e',num2str(e));
end
end
Any help or advice is appreciated!
1 commentaire
Stephen23
le 2 Juin 2021
"Any help or advice is appreciated!"
Join those arrays into one/two arrays (which might be container array, e.g. cell array) and then use indexing.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing 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!