can you please draw a pcolor plot for given data

1 次查看(过去 30 天)
i am sharing one file.In that cell 62 rows available every row contains different variable values in columns..
*can you draw a 'pcolor plot'
x-axis time for 31 days;
y-axis height (only 2 nd column values from each row)
thanks in advance.can you solve it asap please.
x-axis time for 31 days;
y-axis height (only 2 nd column values from each row)
thanks in advance.can you solve it asap please.

采纳的回答

Star Strider
Star Strider 2023-12-20
I suggest using image rather than pcolor, because image displays all the data, while pcolor does not, displaying everything except the last row and last column. The cells in ‘data’ have varying row sizes, so this approach uses the first 31 rows or the maximum row size to fill each column of the ‘Cols’ matrix. Cells with fewer than 31 rows are filled with NaN values to 31 and rows greater than 31 in any cell are discarded.
LD = load('data.mat');
data = LD.data
data = 62×1 cell array
{102×11 double} {104×11 double} {105×11 double} {105×11 double} { 96×11 double} { 63×11 double} {102×11 double} {106×11 double} {104×11 double} {105×11 double} {109×11 double} {103×11 double} {104×11 double} {102×11 double} {103×11 double} {109×11 double}
RowSize = cell2mat(cellfun(@(x)size(x,1), data, 'Unif',0)); % Row Sizes Of Each Cell
Cols = NaN(31,numel(data)); % Preallocate
Col2 = cellfun(@(x)x(:,2), data, 'Unif',0); % Second Column Of Each Cell In 'data'
for k = 1:numel(data)
Cols(1:min(31,RowSize(k)),k) = Col2{k}(1:min(31,RowSize(k))); % Fill 'Cols' Matrix
end
View_Matrix = Cols
View_Matrix = 31×62
16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 41 80 79 78 92 52 95 49 86 44 89 68 89 84 85 43 86 60 50 69 85 51 86 72 90 50 94 60 82 75 100 142 174 123 154 79 157 65 148 63 151 122 160 138 156 61 130 123 83 123 147 69 174 126 161 75 139 77 162 120 144 296 192 303 296 124 299 119 300 126 302 303 304 301 300 124 300 231 118 150 299 114 300 153 305 120 237 122 225 129 288 601 290 600 598 295 601 164 364 135 595 349 313 439 309 151 603 303 163 294 602 123 602 162 441 165 300 303 297 246 297 772 354 629 777 600 780 182 603 153 774 431 597 597 602 269 715 599 297 599 743 177 772 297 460 300 603 562 434 300 598 896 593 771 843 704 856 300 753 297 897 580 737 710 771 296 772 750 600 760 771 304 781 603 570 595 763 599 554 595 786 1219 867 896 900 770 903 373 772 500 1237 599 775 776 904 527 791 902 741 874 904 442 895 679 598 766 782 769 601 680 852 1249 904 1111 977 903 1067 596 896 556 1506 759 898 900 1097 602 895 1488 769 903 1010 572 1186 764 626 899 896 902 770 746 900 1378 1377 1330 1103 1245 1214 757 1128 603 1669 902 946 1515 1393 753 1147 1589 902 999 1505 600 1265 897 776 1503 954 1506 903 765
figure
image(Cols.') % Transpose & Plot
colormap(turbo(max(Cols(:))))
colorbar
Ax = gca;
Ax.YDir = 'normal';
xlabel('Days')
ylabel('Cell Index')
title('‘data’')
.
  6 个评论

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by