Save a Uitable with coloured cells as as png.
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, i've created a Uitable object and colured its cells with this code:
app.UITable.Data=CreateUITable(app, app.deltas_table, app.deltas_threshold);
%% GUI TABLE COLOURING (ANALYSIS MODULE)
% Hightlight over-threshold values in red
[redRows, redCols]= find( abs(app.UITable.Data{:,2}) >= app.deltas_threshold);
z = uistyle('BackgroundColor',[1 0.6 0.6]);
addStyle(app.UITable, z ,'cell',[redRows, redCols]);
addStyle(app.UITable, z ,'cell',[redRows, redCols+1]);
addStyle(app.UITable, z ,'cell',[redRows, redCols+2]);
addStyle(app.UITable, z ,'cell',[redRows, redCols+3]);
% Hightlight under-threshold values in green
[greenRows, greenCols]= find( abs(app.UITable.Data{:,2}) <= app.deltas_threshold);
n = uistyle('BackgroundColor',[0.6 1 0.6]);
addStyle(app.UITable, n ,'cell', [greenRows, greenCols]);
addStyle(app.UITable, n ,'cell',[greenRows, greenCols+1]);
addStyle(app.UITable, n ,'cell',[greenRows, greenCols+2]);
addStyle(app.UITable, n ,'cell',[greenRows, greenCols+3]);
% Hightlight NaN values in gray
NaNidxs = ismissing(app.UITable.Data);
[NaNrow,NaNcol] = find(NaNidxs);
s = uistyle('BackgroundColor',1/255*[200,200,200]);
addStyle(app.UITable,s,'cell',[NaNrow, NaNcol]);
addStyle(app.UITable,s,'cell',[NaNrow, NaNcol+1]);
addStyle(app.UITable,s,'cell',[NaNrow, NaNcol+2]);
addStyle(app.UITable,s,'cell',[NaNrow, NaNcol+3]);
Now i want to save the table on a .png (or pdf) file.
Any help would be really appreciated.
Alessandro
0 件のコメント
回答 (1 件)
Adam Danz
2021 年 4 月 28 日
One solution is to put the uitable within a uipanel and then use exportgraphics to export the table.
If you want to export the entire figure you don't need to embed the table within a panel.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!