How to resize uitable?
5 ビュー (過去 30 日間)
古いコメントを表示
I have a uitable extracting data from a database in my GUI which is displayed upon a click of a button.
I am sending 3 columns of data, however only one column appears with a horizontal scroll bar. I want the table to re-adjust the size depending on he number of columns sent as this can be seleced from 1-3.
Here is my code so far:
FinalOut = [Output, Output2, Output3]; disp(FinalOut);
ColNames = {TableType; TableType2; TableType3}; disp(ColNames);
uitable(handles.figure1,'Data',FinalOut,'ColumnName',ColNames,'Position',[250 20 150 300]);
Is there a way to make this table more flexible/dynamic depending on the columns of data sent, so the width of the table only is changed as data is loaded in?
0 件のコメント
回答 (1 件)
Shubham
2024 年 7 月 31 日
Hey Gurvinder
The width of the table can be changed by adjusting the width of columns based on the maximum length of data it contains. This can be achieved by modifying the 'ColumnWidth' property for each column. You can change the width of columns according to its content by referring to the following article: https://www.mathworks.com/matlabcentral/answers/98616-is-there-an-option-for-the-uitable-object-which-allows-the-width-of-the-columns-to-adjust-according
The 'Position' parameter can also be used along with the 'ColumnWidth' parameter to resize the table columns as done in the following MATLAB Answer: https://www.mathworks.com/matlabcentral/answers/157249-how-to-change-size-of-uitable
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Database Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!