How to plot a time series contour with several unequal matrix?
3 次查看(过去 30 天)
显示 更早的评论
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235291/short%20array.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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/235292/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)
0 个评论
回答(1 个)
Abhisek Pradhan
2019-8-29
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!