Borrar filtros
Borrar filtros

update wait bar if time is long

2 visualizaciones (últimos 30 días)
zeyneb khalili
zeyneb khalili el 6 de Mayo de 2017
Respondida: Walter Roberson el 7 de Mayo de 2017
How can I update waitbar if a plot take long time to load

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Mayo de 2017
Use the Parallel Computing Toolbox parfeval() or batch() to load the openfig() the figure on a worker. The master process can ask the parallel future for its status, whether the worker has started yet and how long it has executed; the master can update a waitbar based upon that.
Note that the graphics objects would end up on the worker and not visible to the master process unless you transferred them from the worker -- but if openfig() is taking a long time then chances are that transferring the graphics object from the worker would take a long time and you would not be able to update a waitbar while that was happening.
If "plot take long time to load" does not mean openfig() but instead means "a long time to compute", then you could use the same parfeval() technique of computing the data in the background. In this case you could transfer the data back to the master process to have it plot visibly. However, during the time the plotting was happening, the master process would not be able to update a waitbar.
If "plot takes long time to load" is talking not about how long it takes to compute the data, but instead about how long it takes to make the plot visible (e.g., a big complicated patch with shading), then there is no way to be certain of updating a waitbar while that is happening; it is not defined as to how much of the graphics drawing happens in the master process and how much happens in a different java thread.
If you do not have the Parallel Computing Toolbox, then the only one of the above cases in which you can do what you are asking is the situation where it is taking a long time to compute the graphics data; in that case the computing routine could update the waitbar. It would have to actively do that updating in that situation.

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by