How to change the cell color of UITABLE in MATLAB?

조회 수: 2 (최근 30일)
Suraj Srivastava
Suraj Srivastava 2015년 2월 19일
답변: Torsion27 2018년 4월 22일
Hi,
I have uitable of 10 row and 3 columns. My 3rd column is editable. I want to change the background color of my 3rd-column.
Kindly help me out. Any suggestion is appreciated. Thank You.
  댓글 수: 1
Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015년 2월 19일
Suraj it is nice of you to ask questions and willing to learn Matlab. However, in this forum, for the sake of politeness, we encourage people who put an effort in answering questions by accepting their answers.
In your case, I see that you have asked 8 questions and have accepted only 1 answer.

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

채택된 답변

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015년 2월 19일
Based on this and this you can add an html table which contains the text of the third column.
A minimal example is:
data = randi(100, 10, 3);
data = reshape(strtrim(cellstr(num2str(data(:)))), size(data));
data(:,3) = cellfun(@(x) ['<html><table border=0 width=400 bgcolor=#FF0000><TR><TD>' x '</TD></TR> </table></html>'], data(:,3), 'UniformOutput', false);
t = uitable('Data', data);
  댓글 수: 1
Suraj Srivastava
Suraj Srivastava 2015년 2월 20일
편집: Suraj Srivastava 2015년 2월 20일
Hi,
Thank you so much for your reply.
I have some question regarding above code- # What is x?
I have following code -
data = rand(14,3); cnames = {'Un-Fixed Program','Maximum Program','Required Portfolios'}; th = uitable('Data',data,'ColumnName',cnames,'ColumnWidth',{50},'ColumnEditable', [true true true]);
Kindly implement the above code in accordance with my code and variables.
Again Thank you so much.

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

추가 답변 (1개)

Torsion27
Torsion27 2018년 4월 22일
I have a similar problem, it would be great if u can help me with this please :)
https://de.mathworks.com/matlabcentral/answers/393866-how-can-i-change-the-color-of-the-row-uitable-when-if-0-die-farbe-der-reihe-im-iutable-soll-sic?s_tid=prof_contriblnk

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by