フィルターのクリア

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 Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by