Borrar filtros
Borrar filtros

Structure array to array

3 visualizaciones (últimos 30 días)
Edward
Edward el 26 de Sept. de 2013
Respondida: Andrei Bobrov el 26 de Sept. de 2013
I have a structure
s(1).x = 5;
s(2).x = 6;
s(1).y = 1;
s(2).y = 8;
how can i convert this into an array of x values and an array of y values, preferably without using a for loop?
Im trying to plot(s(:).x, s(:).y) but it only plots one point hence why i ask.

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 26 de Sept. de 2013
Editada: Azzi Abdelmalek el 26 de Sept. de 2013
s(1).x = 5;
s(2).x = 6;
s(1).y = 1;
s(2).y = 8;
plot([s.x],[s.y])

Andrei Bobrov
Andrei Bobrov el 26 de Sept. de 2013
plot([s.x], [s.y])

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by