plotting - field from a structure

4 vues (au cours des 30 derniers jours)
Pankaj
Pankaj le 27 Jan 2012
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

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Jan 2012
plot([returnProfile.totalReturn],y(:,1));

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by