필터 지우기
필터 지우기

plotting - field from a structure

조회 수: 6 (최근 30일)
Pankaj
Pankaj 2012년 1월 27일
I have the following code in which I fill a structure and then try to plot one of the fields of the structure.
returnProfile = struct('totalReturn',{});
j =0;
for i = 16:8:104
j = j+1;
returnProfile(j,1) = maLong(i/2,i,i/8,i/4);
y(j,1) = i;
end
plot(returnProfile(:).totalReturn,y(:,1));
#*The plot doesn't show anything. am not sure why?* y is an array should "returnProfile(:).totalReturn" be an array i dont see any reason why the plot should not work. all elements are generated as:
y(:,1)
ans =
16
24
32
40
48
56
64
72
80
88
96
104
>> returnProfile(:).totalReturn
ans =
1.6862
ans =
-8.8583
ans =
3.3551
ans =
-4.0201
ans =
-5.0018
ans =
-25.9340
ans =
15.1983
ans =
-10.6162
ans =
15.5172
ans =
4.4779
ans =
-11.4196
ans =
-23.1088

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 27일
plot([returnProfile.totalReturn],y(:,1));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by