필터 지우기
필터 지우기

Using uiimport and subsequent coded commands

조회 수: 12 (최근 30일)
Jason
Jason 2012년 1월 9일
답변: Kenneth Freeman 2021년 1월 14일
Hi guys -
I call uiimport in a GUI to import data, and in the GUI after that call I have some commands that operate on data that is imported. The problem I'm having is that in order to complete the data import using uiimport one has to click the "finish" button in the uiimport window, and before I can do this my code has moved on and attempted to execute operations on variables whose import is not complete. I need to make my code wait until the uiimport action is complete before moving on. Any thoughts?

채택된 답변

Lucas García
Lucas García 2012년 1월 9일
Hi Jason,
In order for your code to wait until uiimport has finished, make sure you request a return value from uiimport.
S = uiimport;
a = 2;
'a' will not be created until the user has finished importing.
  댓글 수: 1
Kenneth Freeman
Kenneth Freeman 2021년 1월 14일
Asking for a return value forces use of the Import Wizard which has fewer options than the Import Tool.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Jason
Jason 2012년 1월 9일
Simple but effective. Thanks Lucas!

Kenneth Freeman
Kenneth Freeman 2021년 1월 14일
Asking for a return value forces use of the Import Wizard which has fewer options for hex data than the Import Tool. Any suggestions for this problem with no return value?

Kenneth Freeman
Kenneth Freeman 2021년 1월 14일
If you don't mind the printouts, the folloiwing code worked for uiimport with no return value. You need to name the returned item importedData to match the existence check. With multiple return variables not sure how to tell which one will be the last one in.
uiimport(filename)
while ~exist('importedData','var')
pause(1)
fprintf('Waiting for importedData\n')
end
The printouts start occuring immediately after the import tool window appears.

카테고리

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