can you please draw a pcolor plot for given data
2 次查看(过去 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.
0 个评论
采纳的回答
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
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
figure
image(Cols.') % Transpose & Plot
colormap(turbo(max(Cols(:))))
colorbar
Ax = gca;
Ax.YDir = 'normal';
xlabel('Days')
ylabel('Cell Index')
title('‘data’')
.
6 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!