- 11 observations of two variables (x and y), where each value is scalar
- 1 observation of two variables (x and y), where each value is a length-11 vector
- 2 observations of 11 variables (unnamed), where each value is a scalar (and these observations are named "x" and "y")
- 2 observations of a single variable (unnamed), where each value is a length-11 vector (and these observations are name "x" and "y")
- something else?
Table setup to rearrange where titles are
31 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Micah
el 24 de Nov. de 2024 a las 20:12
Comentada: the cyclist
el 24 de Nov. de 2024 a las 21:28
I am struggling to get my table to look the way I want it to, I want the titles to be on the left instead of on top of my table.
x=0:1:10;
y=[10,12,15,19,23,25,27,32,34,36,41];
table(x,y)
I wish to get it so the inputs of x are on top of the inputs of y
1 comentario
the cyclist
el 24 de Nov. de 2024 a las 21:28
Before suggesting a way of displaying your data, we may need to understand how your data are structured -- and what they represent.
The norm (not just in MATLAB) is that columns list variables, and rows list observations. Each entry in the table is the value of that variable, for that observation.
It is unclear to me, from what you have posted, the structure of your data. Which is these do you have?
Note that @Animesh's solution implicitly assumes the third option (or possibly the first option, but just showing the table transposed from the norm).
It is very difficult (at least for me) to suggest a solution without understanding the data structure.
Respuestas (1)
Animesh
el 24 de Nov. de 2024 a las 20:36
To create a table with titles on the left instead of on top, you can use MATLAB's table functionality and transpose the data.
You can try something like this:
T = table(x', y', 'VariableNames', {'x', 'y'});
% Transpose the table to have titles on the left
T_transposed = array2table([T.x, T.y]', 'RowNames', {'x', 'y'});
disp(T_transposed);
Here, "x" and "y" are first made into a table with the "table" function, and then it's transposed using "array2table" to switch the rows and columns, with "RowNames" used to label the rows.
You can refer the following MathWorks documentation for more information on "array2table":
0 comentarios
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!