MATLAB Answers

create function to plot several timeseries

1 view (last 30 days)
I have the following timeseries (only few rows are showed):
I have plotted such timeseries and then, by using the "Generate Code" option in the Plot Editor, I have obtained the following code:
function createfigure(ts_wave_heights_1, getcolumn1)
%CREATEFIGURE(ts_wave_heights_1, getcolumn1)
% TS_WAVE_HEIGHTS_1: vector of x data
% GETCOLUMN1: vector of y data
% Auto-generated by MATLAB on 28-Oct-2019 20:01:11
% Create figure
% Create axes
axes1 = axes('Position',[0.130732064421669 0.11 0.775 0.815]);
% Create plot
% Create ylabel
ylabel('wave height (m)','FontName','Times New Roman');
% Create title
title('Wave heigth 1');
% Set the remaining axes properties
set(axes1,'FontName','Times New Roman','FontSize',11,'XGrid','on','XTick',...
Now, I would like to recall this function for plotting different timeseries, for example ts_wave_heights_2. How can I do this?


Sign in to comment.

Accepted Answer

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi on 31 Oct 2019
You can call the function as you call any other function by passing the data to be plotted as input arguments to the function.


Gaetano Pavone
Gaetano Pavone on 31 Oct 2019
I don't understand what I have to define for getcolumn1
Sahithi Kanumarlapudi
Sahithi Kanumarlapudi on 1 Nov 2019
May I know what were you giving for 'getcolumn1' in your previous plot (what were considering for y-axis values)

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!