Drawnow for a single element (uilabel)
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to add a 'status' value to my MATLAB app, and have placed a uilabel to populate via a parallel.pool.DataQueue (with afterEach).
Unfortunately, it doesn't refresh unless the UI completes an update, e.g. triggered by something like 'drawnow'.
Other parts of my application have graphs that I'd rather not have replot at the same time - my main use of the status label will be to indicate that files are being loaded (often in the background, using parfeval), but if the data for the graphs is being loaded, I'd rather see the old/previous graphs until the next ones are ready.
Can I either exclude graphs from a drawnow command, or specify which ui elements I want to refresh?
If not, is there a sensible workaround here? (I can vaguely imagine tracking two sets of graphs, and not updating the data on the graph (or rather, the data being queried to place on the graph) until after the loading completes, but this seems likely to waste effort redrawing large numbers of points just to update a label, and also to be quite a bit harder to read...)
The uiprogressdlg seems to be modal - if I can make it embed in a uipanel or at least not block the uifigure, it would be a possibility, but mainly I'd like to update the status text whilst interacting with existing data on the graphs without really having to pay attention to the status text (a uiprogressdlg seems to act quite differently to that).
0 Commenti
Risposte (1)
dpb
il 20 Lug 2025
Modificato: dpb
il 26 Lug 2025
Use an indeterminate progress dialog and update the .Message property; it will be updated w/o the drawnow. I use it to show progress during a running app and it works well for the purpose.
A code snippet from that app
...
% insert a progress dialog for grins...
h=uiprogressdlg(app.RestrictedAwardsUIFigure, ...
"Title",'Please Standby...',"Message",'Reading Billing',"Indeterminate","on");
% and finally, do the work...
[tBill,tPay,allBills]=readBilling(app.billQualFile,app.billSheet,app.accountingYear,app.semester,app.billUpdate,h);
h.Message='Writing Awards';
writeAwards(tBill,tPay,app.year,app.semester,app.accountingYear,app.awardQualFile,app.awardSheet,h);
h.Message='Update Complete';
pause(0.5)
close(h)
...
The handle is passed to the other routine and inside it is...
function writeAwards(tBill,tPay,year,semester,FY,fn,sheet,varargin)
% fn,sheet - Restricted Awards filename, sheet to update
...
% optional argument for progress bar update fund name
hPrg=[];
if ~isempty(varargin), hPrg=varargin{1}; end
...
% Update all restricted awards from billing for spring/fall sheet
...
for i=1:numel(restrFunds)
ttmp=tBill(ismember(tBill.Fund,restrFunds(i)),{'ROW','SID','Student','Scholarship','FundName','Fund','Paid'});
...
if ~isempty(hPrg) % update progress bar message
hPrg.Message=[ttmp.Fund{1} ' ' ttmp.FundName{1}];
end
...
end
...
0 Commenti
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!