can you please draw a pcolor plot for given data
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mr Thadi
el 20 de Dic. de 2023
Comentada: Star Strider
el 20 de Dic. de 2023
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 comentarios
Respuesta aceptada
Star Strider
el 20 de Dic. de 2023
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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!