How to call load_system function with the path as a variable ?
2 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to get information from a simulink model to the matlab workspace then to java gui . so in java I use a matlab engine to open matlab session then I use evalAsync to execute matlab commands . first I load the simulink model using : load_system function , this works well if I include the path itself when calling the function like : load_system('C:/Users/nouu_/Desktop/untitled.slx') . But what if I want to call the function with the path as a variable like : load_system(p) and the path is stored in the variable p ?? this doesn't work with me . The idea is that I get the path as an input from the user in java gui so I store it in a variable then pass this variable to matlab workspace and load the system . what's the data type of the parameter "sys" of the function : load_system (sys) ?? I store the path in a string variable maybe it shouldn't be string and that's why I get an error !
this is the error :
java.lang.IllegalStateException: Blocking in Event Dispatch Thread not allowed
at com.mathworks.mvm.exec.FutureResult.waitInternal(FutureResult.java:316)
at com.mathworks.mvm.exec.FutureResult.get(FutureResult.java:261)
at com.mathworks.engine.FutureResult.get(FutureResult.java:44)
at com.mathworks.engine.MatlabEngine.putVariable(MatlabEngine.java:530)
2 件のコメント
Shameer Parmar
2019 年 7 月 3 日
Yes, the datatype of the variable 'sys' should be string..
So try to store single string value into your variable sys, including the filename with its extension.. i.e. fullpath/directory + filename + extension.. this should be in single inverted commas.. as a signle string value to your variable 'sys'..
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!