How to matlab display matrix in different way
152 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
matlab display matrix is very problenatic question. my question is How to matlab display matrix as image and Table
example:
For example:
B = magic(3)
disp('The ANS is:')
disp(B)
then how I can display I am see the ans on matlab but i need in detailed.
0 comentarios
Respuestas (2)
Walter Roberson
el 3 de Jul. de 2020
To display as an image on the screen, then you can do things like
for K = 1 : 3; text(0.25*K, 0.5, string(B(:,K))); end
If you want to construct an image in an array (such as you might want to use as a frame of a movie) then use Computer Vision's insertText() to insert each item into the appropriate position in the array.
In MATLAB, there are multiple things that are called "tables".
table() objects:
disp(array2table(B))
uitable() graphic object:
h = uitable('Position', [x y width height], 'Data', B)
The exact syntax used there can only be used with "traditional figures". If you add the container to display into and that container is part of a uifigure() then additional formatting options become available; https://www.mathworks.com/help/matlab/ref/matlab.ui.control.tableappd.addstyle.html
Some people also refer to formatted text output as "tables". Formatted text can be created by sprintf() or compose(), and the displayed with fprintf() or disp(), or you can create formatted items directly to text display with fprintf()
0 comentarios
Sachin Pagar
el 3 de Jul. de 2020
1 comentario
Walter Roberson
el 3 de Jul. de 2020
I do not understand what the question is?
Perhaps the answer is something like
fprintf('The RESULT is:');
fprintf(' %d', B);
fprintf('\n');
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!