필터 지우기
필터 지우기

Structure array to array

조회 수: 3 (최근 30일)
Edward
Edward 2013년 9월 26일
답변: Andrei Bobrov 2013년 9월 26일
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.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 26일
편집: Azzi Abdelmalek 2013년 9월 26일
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 2013년 9월 26일
plot([s.x], [s.y])

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by