Filter löschen
Filter löschen

How to store indexed values from a for loop

1 Ansicht (letzte 30 Tage)
Sean
Sean am 8 Jul. 2014
Beantwortet: Jos (10584) am 8 Jul. 2014
C is a cell array with coordinate locations in "new_pts" that create polygons. I would like to collect each v for all j in an array. how might I do that?
for j=1:length(C)
frodo = C{j};
aragorn_x = new_pts(frodo,1);
aragorn_y = new_pts(frodo,2);
DT = delaunayTriangulation(aragorn_x,aragorn_y);
[K,v] = convexHull(DT);
end

Akzeptierte Antwort

Jos (10584)
Jos (10584) am 8 Jul. 2014
Like with C, you can store them in a cell array
v = cell(size(C))
for j=1:numel(C)
...
[K, v{j}] = convexHull(DT);
end
btw, I prefer numel over length ...

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by