Loading data in the background?

2 次查看(过去 30 天)
Sean
Sean 2012-8-6
I have a set of code that does the following:
  1. Load a set of data
  2. Display the data
  3. Wait for the operator to make a judgement on the data.
  4. Record the user's judgement
  5. Repeat steps 1-4 for the next set of data (hundreds of datasets).
I have found that it takes about 5-10 seconds to load each dataset, and about 10-15 seconds for the user to make the judgement call. Unfortunately, the user is sitting idle while waiting for the data to load between sets.
Does anyone know how to load a .mat file in the background so that the next dataset can be loading while the user is in the process of making his/her judgement?
Thanks in advance.
  5 个评论
Sean
Sean 2012-8-7
编辑:Sean 2012-8-7
It looks like I may have run into a fundamental limitation of matlab. :(
The data that I am using is displayed to the user as changing over time (which requires matlab to be actively updating the gui continuously). Since the load function cannot be interrupted or loaded in a separate thread, I guess I just have to live with the load time wait between data segments.
Thanks for considering my problem.
per isakson
per isakson 2012-8-7
AFAIK: it's in the Parallel Toolbox

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2012-8-19
TIMER objects seem to run in an own thread. Therefore you could load the data in a TIMER callback. But as usual for parallel programming, you have to be smart to avoid collisions between read and write access to the data.
  2 个评论
Sean
Sean 2012-8-20
I have tried implementing a bit of test code to check on the idea that an independent timer could load the data in parallel, but the main code and the timer that I use to scroll through the current data both stop during the load (and continue after load completion).
Maybe I'm missing something, but it doesn't seem like putting the load in a timer callback causes it to run in an independent thread. Is this supposed to be default behavior, or is there something that needs to be set to make it behave this way?
Sean de Wolski
Sean de Wolski 2012-8-20
I had the same thing happen when using the timer.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by