Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

problem with time series objects

Asked by Richard

Richard

on 31 Mar 2012
Accepted Answer by Oleg Komarov

Oleg Komarov

Im using the following to plot a time series plot:

x = cell(1,length(Year));
    fh = figure;
    x = cell2mat(Data{1}');
    ts1 = timeseries(x,1:length(x));
    ts1.TimeInfo.Units = 'hours';
    ts1.TimeInfo.StartDate = ['01-Jan-' Year]; % 
    ts1.TimeInfo.Format = 'mmm, yy';
    ts1.Time=ts1.Time-ts1.Time(1);
    plot(ts1,'--k','linewidth',2);
    xlabel('Time');
    ylabel('Jm^{-2}');

However, the ylabel doesnt show as it should, in this case the ylabel should be Joules per meter squared, but the correct format isn't displayed on the plot, it just shows exactly what is written in the code. I also tried:

       set(get(gca,'Ylabel'),'String','Jm ^{-2}');

But had the same outcome. How do I get the ylabel to respond as it would with regular figures?

0 Comments

Richard

Richard

Products

No products are associated with this question.

1 Answer

Answer by Oleg Komarov

Oleg Komarov

on 31 Mar 2012
Accepted answer
h = ylabel('Jm^{-2}');
set(h,'interpreter','tex')

0 Comments

Oleg Komarov

Oleg Komarov

Contact us