Error with a plot

1 次查看(过去 30 天)
Pul
Pul 2021-8-12
Hello everyone,
I should position higher the data (see for) in which you can see the error; how can I solve this problem?
And how can I remove the spikes?
Thank you very much.
load('giulia_TT.mat')
giulia_monthly=retime(giulia_TT,'monthly','mean');
load('giulia_monthly_DELTA');
E = giuliamensile.Height
E = 254×1
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NEW_6=E *0.35 *10;
% c=giuliamensile{:,1};
% c=datetime(c,'InputFormat','MM-yyyy');
plot(giulia_monthly.Time,NEW_6(:,1),'g-^' ,'MarkerEdgeColor','k','MarkerFaceColor','g') ;
hold on
A=giulia_monthly
A = 254×6 timetable
Time Var1 Var2 Var3 Var4 Var5 Var6 ___________ ______ ______ _______ ______ ______ ______ 01-Dec-1997 221.18 9.3988 -24.618 54.087 NaN 719.08 01-Jan-1998 222.44 6.4382 -27.719 51.995 NaN 713.54 01-Feb-1998 229.43 11.835 -33.772 52.147 NaN 713.52 01-Mar-1998 220.15 11.36 -44.731 74.269 NaN 706.27 01-Apr-1998 217.36 13.978 -45.972 79.505 NaN 705.94 01-May-1998 NaN NaN NaN NaN NaN NaN 01-Jun-1998 NaN NaN NaN NaN NaN NaN 01-Jul-1998 NaN NaN NaN NaN NaN NaN 01-Aug-1998 NaN NaN NaN NaN NaN NaN 01-Sep-1998 NaN NaN NaN NaN NaN NaN 01-Oct-1998 NaN NaN NaN NaN NaN NaN 01-Nov-1998 214.66 10.068 -28.822 68.178 15.986 712.44 01-Dec-1998 214.34 9.0228 -25.128 69.363 16.382 716.01 01-Jan-1999 192.43 8.3011 -24.025 74.332 17.825 716.16 01-Feb-1999 214.84 9.369 -38.714 60.56 18.259 714.97 01-Mar-1999 213.35 10.418 -51.506 46.922 20.138 710.51
for i =113:121
A(i)=A(i)+171.68;
end
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).
plot(giulia_monthly.Time(:,1),A);

回答(1 个)

Jakeb Chouinard
Jakeb Chouinard 2021-8-12
For removing the spikes, I would recommend looking into the function filloutliers. Since your data isn't meant to be terribly consistent, you will likely need to use a windowed approach, which is further detailed in its documentation.
For your plotting error, you are attempting to index into a table without specifying where on the table you wish to index into. I'm not sure what part you're trying to access, but you should be using methods found here.
Cheers,
Jakeb

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by