Borrar filtros
Borrar filtros

plotting - field from a structure

6 visualizaciones (últimos 30 días)
Pankaj
Pankaj el 27 de En. de 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

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de En. de 2012
plot([returnProfile.totalReturn],y(:,1));

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by