how to align text in a table cell

조회 수: 2 (최근 30일)
tou
tou 2011년 6월 1일
hay I create a table in a GUI, this table contains data. that aligns the center of cells, so how I want to align text left in the cell
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2011년 6월 1일
Do you want to align numbers or strings to the left?
Can you provide an example of what you've done?
tou
tou 2011년 6월 4일
align string

댓글을 달려면 로그인하십시오.

답변 (3개)

Jan
Jan 2011년 6월 4일
The display of your above text looks very strange in my browser. A picture would be better.
Because the Matlab UITABLE does not offer a method to alighn text, you could try: FEX: Java-Table

Walter Roberson
Walter Roberson 2011년 6월 1일
Set the format for that column to '%15s' or whatever you want the width to be. Strings which are shorter than that number will be right-padded with spaces.
  댓글 수: 2
tou
tou 2011년 6월 4일
exemple please
Walter Roberson
Walter Roberson 2011년 6월 4일
set(handles.uitable, 'ColumnFormat', {'char',[],[],[]} );

댓글을 달려면 로그인하십시오.


tou
tou 2011년 6월 4일
I use a guide to realize my ihm, and I put the following code :
rowHeaders = {'piyavskii','evtushenko passif','evtushenko itiratif','brent','branch & bound piyavskii'};
columnHeaders = {'nombre d evaluation','argmin f(x)','min f(x)','temps execution'};
set(handles.uitable,'RowName',rowHeaders);
set(handles.uitable,'ColumnName',columnHeaders);
set(handles.uitable,'data',M );% M is matrix
here our results:
-------------------------------------------------------------------------
| nombre d evaluation | argmin f(x) ...
------------------------------------------------------------------------
piyavskii |
-------------------------------------------------------------------
evtushenko passif |
-------------------------------------------------------------------
.
. |
----------------------------------------------------------------
branch & bound piyavskii |
---------------------------------------------------------------
but I want the results like this:
-------------------------------------------------------------------------
| nombre d evaluation | argmin f(x) ...
------------------------------------------------------------------------
piyavskii |
-------------------------------------------------------------------
evtushenko passif |
-------------------------------------------------------------------
.
. |
----------------------------------------------------------------
branch & bound piyavskii |
---------------------------------------------------------------
how ? thank you.

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by