¿Como puedo resaltar la o las filas de una tabla en guide?
1 view (last 30 days)
Show older comments
Estimados, tengo un problema con mi programa en guide, tengo una tabla, la cual se llena automaticamente y no se puede editar, hay un cuadro estatico el cual tiene un numero. supongamos que este numero es 36. mi tabla tiene 4 columnas. en la primera columna hay una serie de numeros (16,24,32,40,54) y las demas columnas tienen informacion que va de la mano con esos numeros. quiero que en mi tabla resalten las filas de los numeros que sean mayores a mi numero de mi cuadro estatico. aqui el detalle es que ese numero (36) puede variar.
Saludos y espero puedan ayudarme.
Accepted Answer
Voss
on 31 Dec 2023
Edited: Voss
on 31 Dec 2023
For a uitable in a figure (e.g., as created in GUIDE), in order to highlight certain rows, you can set the BackgroundColor property:
% create a uitable in a figure:
figure('Position',[1 1 450 120])
t = uitable('Data',magic(5),'Position',[1 1 450 120]);
% highlight rows where the 1st column value is greater than 10:
idx = t.Data(:,1) > 10;
bgc = ones(size(t.Data,1),3);
bgc(idx,:) = repmat([1 1 0],nnz(idx),1);
t.BackgroundColor = bgc;
Your static text box callback would include code similar to the above, where instead of 10 you'd use the the static text box String, e.g.:
val = str2double(get(handles.static_text,'String'));
idx = [handles.table.Data{:,1}] > val;
bgc = ones(size(handles.table.Data,1),3);
bgc(idx,:) = repmat([1 1 0],nnz(idx),1);
handles.table.BackgroundColor = bgc;
0 Comments
More Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!