Pause code until Excel file stored

8 ビュー (過去 30 日間)
Marlo Wegener
Marlo Wegener 2016 年 3 月 22 日
コメント済み: Marlo Wegener 2016 年 3 月 23 日
Hello, I use Excel documents for defining Inputs- and to Simulink models. Now I'm working on a script to update a model when I manually change the Excel file where I define the inputs. Right now I use winopen('myfile') for opening the file. So now I want to pause the code until the Excel file is closed or stored. Is there some easy way to do that?

採用された回答

MHN
MHN 2016 年 3 月 23 日
This way might work. when you open and Excel file it generate a hidden file (i forget the file extend and I have not Excel right now). You can check whether that file exist in the directory or not. If that file is there, it means the excel is open. The following code checks whether a file exist in current directory or not.
if exist(Name, 'file') == 2 %if the Name file exist, then exist(Name, 'file') will return 2.
  1 件のコメント
Marlo Wegener
Marlo Wegener 2016 年 3 月 23 日
Yeah, that might work if the file did not exist before but in my case I want to update an already existing file. Unfortunately that does not work.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by