How to plot a time series contour with several unequal matrix?

4 visualizaciones (últimos 30 días)
Kuan-Chen Wang
Kuan-Chen Wang el 26 de Ag. de 2019
Respondida: Abhisek Pradhan el 29 de Ag. de 2019
Hi guys!
I have pressure, time and temperature data from multiple observations .But the size of matrix are not the same!
For example, my 1st matrix look like this(and time might be 10:58, not include in the excel table):
short array.PNG
But the next data set, the number of data may have over the amount of 1000!!
My first question is how to combine them through program?
At first, I try the code below:
code.PNG
As you can see, I have 18 staions, and I actually have more.
It can be combined by copy and paste for 18 and more times, but can it be more easier?
the problem in the code is that if number of data is unequal, MATLAB cannot combine them into one matrix
Also the function contourf cannot work since the wrong dimension of each matrix.
Thanks for reading all of them(and my poor expression)

Respuestas (1)

Abhisek Pradhan
Abhisek Pradhan el 29 de Ag. de 2019
A simple way will be to concatenate all the matrixes vertically as all of them have the same number of columns. This can be done by reading the sheets in the excel files and saving it as a cell array and then concatenating the cell array to a matrix.
[~,sheet_name]=xlsfinfo('filename.xlsx');
for k=1:numel(sheet_name)
data{k}=xlsread('filename.xlsx',sheet_name{k});
end;
Iterate over all elements of the cell array and concatenate them using vertcat to form a matrix. Now contourf can be used for plotting.

Categorías

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

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by