Visualize data in a pivot-table like style

3 visualizaciones (últimos 30 días)
Sebastian Stumpf
Sebastian Stumpf el 6 de Feb. de 2024
Editada: Sebastian Stumpf el 7 de Feb. de 2024
Dear all,
I tried a lot, even the new Pivot function in Matlab 2023a, but I can not achieve what I am looking for.
I have this kind of data containing x, y and z values (See attached file "Testvalues.mat"). Sometimes there are more datapoints, sometimes less. And I want to have a chart looking like this (made in Excel for demonstration):
It is some kind of Pivottable, but I have diffiulties to achieve a visualization like this. The order is from -4500 to 12000 and 1500 to 10500 important.
Is there a way to get this output as a table with a Matlab function or code?
Thanks a lot and kind regards,
Sebastian

Respuesta aceptada

Harald
Harald el 6 de Feb. de 2024
Hi,
unstack and a few modifications should do the job:
load TestValues.mat
T = array2table(dataset8_max_langs);
T.dataset8_max_langs1 = cell2mat(T.dataset8_max_langs1);
T.dataset8_max_langs2 = cell2mat(T.dataset8_max_langs2);
T.dataset8_max_langs3 = string(T.dataset8_max_langs3);
T2 = unstack(T, "dataset8_max_langs3", "dataset8_max_langs1", ...
"VariableNamingRule","preserve");
T2 = fillmissing(T2, "constant", "", "DataVariables",@isstring);
T2 = sortrows(T2, "dataset8_max_langs2", "descend");
It seems like the data you have provided is not the same as the data you used for the chart. That makes it difficult to compare. Thus, please let me know if this is not the format you have been looking for. For example, you may want to use dataset8_max_langs2 instead of dataset8_max_langs1 in the unstack command.
Best wishes,
Harald
  1 comentario
Sebastian Stumpf
Sebastian Stumpf el 7 de Feb. de 2024
Editada: Sebastian Stumpf el 7 de Feb. de 2024
Hi,
thank you very much for the quick and competent help. This is it! I was on the right way, but this is very helpful. The only thing that's missing is, that the data contains integer numbers and non-integer numbers. I just need the integer numbers in the finished table. But I can figure this out by myself.
Sorry for not providing the same data as the data I used for the chart.
Nevertheless, thank you very much!
Kind regards,
Sebastian

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by