Wait for Google Earth to finish loading before invoking the next command
조회 수: 7 (최근 30일)
이전 댓글 표시
I am working on feeding Matlab's simulation data to Google Earth Plug-in via COM.
My problem is that the command,which should be invoked after Google Earth finished loading, is invoked before that. That brings of course error.
I could use the pause command to pause the code waiting the Google Earth to load. But, this solution is not that efficient, as I don't know exactly how fast or how slow Google Earth will load on different machines.
I've also tried using the properties of the COM object. It was close, but no cigar. The code looks like this
waitfor(h.Document.parentWindow.document,'readyState','complete')
or also this one:
while strcmp(h.Document.parentWindow.document.readyState,'complete')== 0
pause(1);
end
Is there any object properties that could be used? Thanks!
댓글 수: 0
채택된 답변
Jason Ross
2011년 6월 9일
I don't have a particular answer to this exact question, but when faced with similar situations in the past, most specifically waiting for a network resource to be up, I added a check that polls for an expected result (for example, a network share exists) and then continues.
So you might want to actually try to do something trivial that requires the application be available and functioning (get the version, get some data, etc), and only continue when you get a decent response. You would likely also want to add an overall timeout, as well -- in the event you can never connect due to some other problem.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Google Earth에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!